Jump to content
Ketarin forum

Extracting PortableApps.com *.paf.exe packages


AussieJim
 Share

Recommended Posts

I just discovered Ketarin – what an awesome app. I’m using it primarily to keep a bunch of portable apps up-to-date, which are synced across multiple machines using Live Sync. I’m using post-download commands to extract my apps at the time of download. Those that just need to be unzipped are easy; harder are those in PortableApps.com *.paf.exe format. Unfortunately, there’s no longer a silent install switch for the installer (see this PA.com thread).

 

I use FranciscoR’s PA template (link) to download PA apps. In order to extract the apps, I wrote a small AutoHotkey script. It’s working great for me, so I thought I’d share it.

 

It expects 2 arguments: the full path to the downloaded *.paf.exe package ({file}); and the folder to extract it to. It runs the PAF installer using the defaults for all screens, except for install location, which uses the location specified in the second argument. This isn’t exactly a silent install, but it’s automatic, and quick. Note that user keyboard and mouse input is blocked during extraction, so that the installer window maintains focus and no extraneous keystrokes screw things up, but the installs are typically quick.

 

Below is the script, which can be modified to handle non-default inputs for specific apps if needed. Copy the text, and save as pafInstall.ahk. AutoHotkey can be downloaded here. To call from a Ketarin command:

 

"full path\AutoHotkey.exe" "full path\pafInstall.ahk" "{file}" "full destination path"

 

One bonus: the paf installer /destination switch allows you to specify a folder for extraction, but the installer adds an additional subfolder with the application’s name. The attached script allows complete control over the destination folder.

 

Enjoy!

 

-jim.

 

; Macro to install PortableApps.com downloads, as PAF installer can't be run silently. 
; Also, paf installer appends its own app name to /destination path specified via command line; this script gives complete control over destination folder.
; Arguments: 
;      file = full path to *.paf.exe package
;      destdir = folder to install to
; If compiled, this script can be called by following command line:
;      pafInstall.exe file destdir       
; If not compiled, call by following command line:
;       autohotkey.exe pafInstall.ahk file destdir
; Typically invoked from Ketarin after-download command:
;       autohotkey.exe pafInstall.ahk "{file}" "{file:directory}" 
;   or pafInstall.exe "{file}" "{file:directory}"         (Note: Compiled scripts cause Vista UAC prompts, so better not to compile)
; (autohotkey.exe, pafInstall.ahk & pafInstall.exe need to include full paths)
;
; Jim Cumming 12/4/09


#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetTitleMatchMode 2    ;Set titlematch to "contains" (default is "starts with"). Affects #IfWinActive's below. 

If 0 <> 2             ;actually looking at %0%, which contains number of arguments. Must be 2.
{    msgbox ERROR: Must have 2 arguments (package file, destination folder); exiting.
   Return
}
Else
{    file = %1%
   destdir = %2%
   Run %file%
   BlockInput On            ;Block user keyboard and mouse input during extraction
   WinWaitActive Installer Language
   Send {Return}            ;Hit OK to default language of English
   WinWaitActive PortableApps.com Installer
   Loop
   {    Sleep 100
       IfWinActive ,,&Install
       {    Send %destdir%                ;Enter install directory
           Sleep 100
           Send {Return}                ;Click Install button
           WinWaitActive ,,&Finish        ;Wait for Install to finish - screen with Finish button will appear
           Sleep 100
           Send {Return}                ;Click Finish button
           break                        ;Break out of the loop
       }
       else
           Send {Return}                ;Hit Next button, leaving values as default
   }    
BlockInput Off
Return
}

Link to comment
Share on other sites

  • 9 months later...

Hope you don't mind, i've updated the script to cope with installers that don't offer a language option, those that do and those that have license agreements you need to 'accept'.

 

The below script is most likely clunky as I just read the AHK documentation and made this BUT it works for all portableapps.com installers that i've tested which is a wide variety. If anyone finds one that this script doesn't work for please tell me and i'll fix it up.

 

; Macro to install PortableApps.com downloads, as PAF installer can't be run silently. 
; Also, paf installer appends its own app name to /destination path specified via command line; this script gives complete control over destination folder.
; Arguments: 
;      file = full path to *.paf.exe package
;      destdir = folder to install to
; If compiled, this script can be called by following command line:
;      pafInstall.exe file destdir       
; If not compiled, call by following command line:
;       autohotkey.exe pafInstall.ahk file destdir
; Typically invoked from Ketarin after-download command:
;       autohotkey.exe pafInstall.ahk "{file}" "{file:directory}" 
;   or pafInstall.exe "{file}" "{file:directory}"         (Note: Compiled scripts cause Vista UAC prompts, so better not to compile)
; (autohotkey.exe, pafInstall.ahk & pafInstall.exe need to include full paths)
;
; Jim Cumming 12/4/09


#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetTitleMatchMode 2    ;Set titlematch to "contains" (default is "starts with"). Affects #IfWinActive's below. 

If 0 <> 2             ;actually looking at %0%, which contains number of arguments. Must be 2.
{    msgbox ERROR: Must have 2 arguments (package file, destination folder); exiting.
   Return
}
Else
{   file = %1%
   destdir = %2%
   Run %file%

BlockInput On            ;Block user keyboard and mouse input during extraction

   Loop
   {

       IfWinExist, Installer Language 
       {
           WinActivate
           Send {Return}
       }

       Sleep 100    

       IfWinExist, PortableApps.com Installer, This wizard
       {
           WinActivate
           Send {Return}
       }

       Sleep 100

       IfWinExist, PortableApps.com Installer, License Agreement
       {
           WinActivate            
           Send {Tab}
           Send {Space}
           Send {Return}
       }

       Sleep 100

       IfWinExist, PortableApps.com Installer, Choose Components
       {
           WinActivate
           Send {Return}
       }

       Sleep 100

       IfWinExist, PortableApps.com Installer, Choose Install Location
       {
           WinActivate
           Send %destdir%
           Send {Return}
       }

       Sleep 100

       IfWinExist, PortableApps.com Installer, Finish
       {
       Send {Return}
       Break
       }

   }

}
BlockInput Off
Return

 

EDIT: I've tweaked the code to be about 500 times cleaner and a bit more reliable.

Edited by Omniferum
Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.