I love the Chrome browser, but I hate the lack of it's portability. So, I wrote a script to make it portable, using a parameter.
I actually made two, one for normal and one for incognito version.
Problem is, it breaks the updates of the browser, so I wrote an updater as well.
You can find all scripts below.
Bugs, suggestions, please let me know.
Usage:
put the scripts in a separate folder and run them.
For the Chromium Portable to work, you might want to run the updater first, that will install a developer build of Chromium for you and get you started.
You'll have to compile the Chromium Portable script if you want to start Chromium Portable using the installer.
Note: I'm a self taught coder, so if there's a better way of doing something, or if I made a mistake, please let me know. However, I do use these scripts myself, so there shouldn't be any bugs.
Chromium Portable
#NoTrayIcon
parameter = %1%
if parameter <>
{
SplitPath , parameter,,,OutExtension
if OutExtension = URL
{
IniRead , URL, %parameter%, InternetShortcut, URL, ""
outputdebug url = %url% (%parameter%)
}
else
URL = %parameter%
}
run "%A_ScriptDir%\chromium\chrome.exe" %URL% --user-data-dir="%A_ScriptDir%\Profile" --purge-memory-button --enable-user-scripts,, useerrorlevel
exitappChromium Portable Incognito
#NoTrayIcon
parameter = %1%
if parameter <>
{
SplitPath , parameter,,,OutExtension
if OutExtension = URL
{
IniRead , URL, %parameter%, InternetShortcut, URL, ""
outputdebug url = %url% (%parameter%)
}
else
URL = %parameter%
}
run "%A_ScriptDir%\chromium\chrome.exe" %URL% --user-data-dir="%A_ScriptDir%\Profile" --incognito --purge-memory-button --enable-user-scripts, %A_ScriptDir%, useerrorlevel
exitappChromium Updater *updated*
ProgramName = Chromium Updater
ProgramVersion = 0.02
#SingleInstance Force
; check latest version
ifexist %A_ScriptDir%\latest.txt
filedelete %A_ScriptDir%\latest.txt
URLDownloadToFile , http://build.chromium.org/buildbot/snapshots/chromium-rel-xp/LATEST , %A_ScriptDir%\latest.txt
FileRead , latest , %A_ScriptDir%\latest.txt
; check installed version
ifexist %A_ScriptDir%\installed.txt
FileRead , installed , %A_ScriptDir%\installed.txt
; compare versions
if installed = %latest%
{
msgbox , , %programname% %programversion%, Latest version already installed.`n`n%programname% %programversion% will now quit., 5
exitapp
}
if latest is Number
{
ifnotexist %A_ScriptDir%\chrome-win32_%latest%.zip
{
msgbox , , %programname% %programversion%, Downloading latest version: chrome-win32_%latest%.zip`n`nPlease wait until you see another msgbox., 10
URLDownloadToFile , http://build.chromium.org/buildbot/snapshots/chromium-rel-xp/%LATEST%/chrome-win32.zip , %A_ScriptDir%\chrome-win32_%latest%.zip
}
}
Else
{
msgbox , , %programname% %programversion%, Problem getting the latest version`, updater will now quit.
ExitApp
}
; ask user if he wants to install the last version
ifexist %A_ScriptDir%\chrome-win32_%latest%.zip
{
msgbox , 4 , %programname% %programversion%, Latest version successfully downloaded:`n%A_ScriptDir%\chrome-win32_%latest%.zip`n`nWould you like to install the new version? (press Yes or No)
IfMsgBox Yes
{
ifnotexist %A_ScriptDir%\unzip.exe
urldownloadtofile , http://stahlworks.com/dev/unzip.exe , %A_ScriptDir%\unzip.exe
checkprocess:
; check if chromium in the target folder is loaded, if yes, then ask to close it, else quit
Process , exist , chrome.exe
if Errorlevel <> 0 ; -- 0 means it didn't exist
{
msgbox , 4 , %programname% %programversion%, Chromium is in use, please close Chromium and click yes below.`n`nIf you select No, %programname% %programversion% will quit.
IfMsgBox Yes
gosub checkprocess ; -- check again
else
exitapp ; -- close
}
; -- make room for the backup
ifexist %A_ScriptDir%\Chromium_backup
FileRemoveDir , %A_ScriptDir%\Chromium_backup , 1
ifexist %A_ScriptDir%\Chromium
{
FileMoveDir , %A_ScriptDir%\Chromium , %A_ScriptDir%\Chromium_backup , R
if errorlevel = 1
{
retry += 1
if retry = 1
{
msgbox , , %programname% %programversion%, Chromium folder could not be updated. %programname% will now quit.
exitapp
}
else
gosub checkprocess
}
}
ifnotexist %A_ScriptDir%\Chromium
{
msgbox , , %programname% %programversion%, New version is now being unzipped.`n`nPlease be patient., 5
RunWait , "%A_ScriptDir%\unzip.exe" "%A_ScriptDir%\chrome-win32_%latest%.zip", %A_ScriptDir% , min UseErrorLevel
FileDelete , %A_ScriptDir%\installed.txt
FileAppend , %latest% , %A_ScriptDir%\installed.txt
FileMoveDir , %A_ScriptDir%\chrome-win32 , %A_ScriptDir%\Chromium , R
if errorlevel <> 1
{
msgbox , 4 , %programname% %programversion%, New version is now installed.`n`nPress Yes to run it? Press No to close the updater.
IfMsgBox Yes
{
ifexist %A_ScriptDir%\chromium portable.exe
Run , %A_ScriptDir%\chromium portable.exe
else
Run , %A_ScriptDir%\chromium\chrome.exe
}
else
exitapp ; -- close
}
}
}
}
exitapp




