Omniferum Posted December 7, 2012 Report Share Posted December 7, 2012 Been a while since i've contributed so thought I would now. First things first, the below code is an autohotkey script that will install any portableapps.com package silently and without user interaction. A screen 'might' pop up but it will be automatically minimized. If you experience some minor issue with keyboard/mouse not working while the script is running it is because everytime a command is sent to the window I disable the keyboard/mouse for a second so as whatever you are doing doesn't interfere accidentally. This will NOT work for portableapps that are just add-ons. Stuff like GPG for Thunderbird obviously need to know where thunderbird is etc. but all base installs will work just fine. #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 < ;actually looking at %0%, which contains number of arguments. Must be 2. { MSGBOX ERROR: Must have at least 2 arguments (package file, destination folder); exiting. Return } Else { file = %1% destdir = %2% wait = 500 Run, %file%,, Min,runpid Loop { Sleep %wait% IfWinExist, ahk_pid %runpid%, The portable app can not be upgraded while it is running { MsgBox, 4144, User Interaction Required, You are trying to upgrade a program that is currently open!`n`nPlease FIRST close all instances of the program then click OK on these two windows } IfWinExist, ahk_pid %runpid%, Please select a language { BlockInput On ControlSend,, {Return}, ahk_pid %runpid% WinMinimize, ahk_pid %runpid% BlockInput Off } IfWinNotExist, ahk_pid %runpid%, Choose Install Location { BlockInput On ControlSend,, {Return}, ahk_pid %runpid% WinMinimize, ahk_pid %runpid% BlockInput Off } else { Break } } WinWait, ahk_pid %runpid%, Choose Install Location { Sleep %wait% BlockInput On Control, EditPaste, %destdir%, Edit1, ahk_pid %runpid% BlockInput Off Sleep %wait% BlockInput On ControlSend,, {Return}, ahk_pid %runpid% WinMinimize, ahk_pid %runpid% BlockInput Off } WinWait, ahk_pid %runpid%, Finish { Sleep %wait% BlockInput On ControlSend,, {Return}, ahk_pid %runpid% WinMinimize, ahk_pid %runpid% BlockInput Off } } The below template is what I use for ALL my portableapps.com installs. Remember to edit the variables to your needs. <?xml version='1.0' encoding='utf-8'?> <Jobs> <ApplicationJob xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <WebsiteUrl /> <UserNotes /> <IgnoreFileInformation>false</IgnoreFileInformation> <DownloadBeta>Default</DownloadBeta> <CheckForUpdatesOnly>false</CheckForUpdatesOnly> <VariableChangeIndicator>version</VariableChangeIndicator> <CanBeShared>true</CanBeShared> <ShareApplication>false</ShareApplication> <ExclusiveDownload>false</ExclusiveDownload> <UserAgent>{sfua}</UserAgent> <HttpReferer /> <Variables> <item> <key> <string>download</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>RegularExpression</VariableType> <Regex>[^"'=]+(?>\.exe)</Regex> <Url>{page}</Url> <Name>download</Name> </UrlVariable> </value> </item> <item> <key> <string>name</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>RegularExpression</VariableType> <Regex><title>(.*?) \|</Regex> <Url>{page}</Url> <Name>name</Name> </UrlVariable> </value> </item> <item> <key> <string>page</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <TextualContent><placeholder name="Application Page URL"/></TextualContent> <Name>page</Name> </UrlVariable> </value> </item> <item> <key> <string>version</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>RegularExpression</VariableType> <Regex>Date updated.*?\n</Regex> <Url>{page}</Url> <Name>version</Name> </UrlVariable> </value> </item> </Variables> <ExecuteCommand>/*This is a comment line, the line below is the C# script. It will run the instructions found in the Setup Tab. If the command below is encapsulated with stars and slashes merely remove them to make the command function, otherwise it will remain a comment*/ app.Install(null);</ExecuteCommand> <ExecutePreCommand>if "{download}" EQU "" START CMD /C "ECHO {appname}: Unable to find download, investigate & PAUSE & exit& if "{FixedDownloadUrl}" EQU "" if "{FileHippoId}" EQU "" START CMD /C "ECHO {appname}: Unable to find download, investigate & PAUSE & exit&</ExecutePreCommand> <ExecuteCommandType>CS</ExecuteCommandType> <SetupInstructions> <SetupInstruction xsi:type="CustomSetupInstruction"> <Code>start /wait "" "{AHK}" "{startuppath}PA.ahk" "{file}" "{installpath}{category}\{appname:regexreplace: \(.*\):}" ::Creating and renaming a custom .ini to disable splash screen if exist "{installpath}{category}\{appname:regexreplace: \(.*\):}\*Portable.ini" exit for /f "tokens=*" %a in ('dir /b "{installpath}{category}\{appname:regexreplace: \(.*\):}\Other\Source\*Portable.ini"') do ( set ini={installpath}{category}\{appname:regexreplace: \(.*\):}\Other\Source\%a set file=%a ) For /f "tokens=*" %i in ('type "%ini%"') do if /I "%i" EQU "DisableSplashScreen=false" (echo DisableSplashScreen=true>>"{installpath}{category}\{appname:regexreplace: \(.*\):}\%file%") else (echo %i>>"{installpath}{category}\{appname:regexreplace: \(.*\):}\%file%") for /f "tokens=*" %a in ('dir /b "{installpath}{category}\{appname:regexreplace: \(.*\):}\*.exe"') do set exe=%~na if exist "{installpath}{category}\{appname:regexreplace: \(.*\):}\*Portable.ini" rename "{installpath}{category}\{appname:regexreplace: \(.*\):}\%file%" "%exe%.ini" ::Creating and renaming a custom .ini to disable splash screen</Code> <Type>Batch</Type> </SetupInstruction> </SetupInstructions> <Category><placeholder name="Category" options="{categories}" /></Category> <SourceType>FixedUrl</SourceType> <DeletePreviousFile>true</DeletePreviousFile> <Enabled>true</Enabled> <FileHippoId /> <TargetPath>{downloadpath}{category}\</TargetPath> <FixedDownloadUrl>{download:urldecode}</FixedDownloadUrl> <Name><placeholder name="Name of application" variable="name" /></Name> </ApplicationJob> </Jobs> Link to comment Share on other sites More sharing options...
necrox Posted December 14, 2012 Report Share Posted December 14, 2012 A nice way to install PA. Thank you for sharing this! Link to comment Share on other sites More sharing options...
wattpuppy Posted February 14, 2014 Report Share Posted February 14, 2014 I think PA forgot what "Portable Apps" was supposed to be all about. i.e. not needing to install. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now