corgano Posted March 25, 2010 Posted March 25, 2010 (edited) This is a version of the chrome portable launcher I made that supports multiple accounts.Edit: -Rewrote it completely to be user friendly. -updating chrome is now as easy as deleting chrome, downloading, and extracting a newer version to the same placeHow to use it:-Place in the folder containing the chrome dir (usually program files\google)-click new, and enter a name for your profile in the input box-Select Your profile in the combo box and hit launchNew code:expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=chromelauncher.exe #AutoIt3Wrapper_Compression=4 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> Global $profildatapath = @scriptdir&"\data\" $list = getprofils() $gui = GUICreate("Please select profile", 110, 130) $new = GUICtrlCreateButton("New",10,10,40,25) $del = GUICtrlCreateButton("Delete",60,10,40,25) $selected = GUICtrlCreateCombo("",10,50,90,30) GUICtrlSetData($selected,$list) $go = GUICtrlCreateButton("Launch",10,90,90,25) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg case $GUI_EVENT_CLOSE Exit Case $new $add = InputBox("New","Please enter name for new profile") $list = $add & "|" & $list GUICtrlSetData($selected,"") GUICtrlSetData($selected,$list,$add) Case $del DirRemove($profildatapath & GUICtrlRead($selected),1) Case $go ShellExecute("Chrome\chrome.exe", '--user-data-dir="' & $profildatapath & GUICtrlRead($selected) & '"') Exit EndSwitch WEnd Func getprofils() $search = FileFindFirstFile($profildatapath & "*.*") $list = "" While 1 $list &= FileFindNextFile($search) & "|" If @error Then ExitLoop WEnd FileClose($search) Return StringTrimRight($list,1) EndFuncNo INI's or files to mess around with. It's just that easyThe folder structure should look like:"<folder>\chrome\chrome.exe""<folder>\launcher.au3""<folder>\data\<profile data folders>"old script and how to (useless): -Fixed GUI size -Fixed undefined variables -Fixed broken directory (memory sticks letter can change, now positation is based off program location) -@scriptdir is now used in INI file -Now it actually works!To use: 1: place in chrome dir 2: run itWhat it does: -It will make an INI file, and a newprofil folder in the script dir. It will keep the settings here instead. -It will use thease settings every time it is run. (until there are more profiles) -It will display a GUI prompting to select a profile if more than 1 profile exists.How to: -Change the name of the profile, change it in the ini file. Make sure to change the profile folder if necesary -Add a profile, make a new entry in the ini (Folder will be created by chrome)Example:[account1] path=H:\Programs\chrome\account folder one [two] path=@scriptdir\accnt folder two [three] path=C:\Users\Public\foldercanbeanywereAnd the code:expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=chromium.ico #AutoIt3Wrapper_outfile=chromelauncher.exe #AutoIt3Wrapper_Compression=4 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> $ini = @ScriptDir & "\launcher.ini" $var = IniReadSectionNames($ini) If @error Then IniWrite($ini,"New","path","@scriptdir\Newprofil") $path = @scriptdir&"/Newprofil" go($path) Else If $var[0] = 1 Then $path = IniRead($ini,$var[1],"path","Error") ConsoleWrite("Found " & $var[1] &" at "& $path & ". It is the only profile." & @crlf) go($path) Else dim $but[$var[0]+1][2] $width = 90 $hight = 30 $gap = 10 $gui = GUICreate("Please select profile", $width + ($gap * 2), $gap + (($hight + $gap) *$var[0])) For $i = 1 to $var[0] $but[$i][0] = GUICtrlCreateButton($var[$i],$gap,($hight + $gap) * ($i-1) + $gap,$width,$hight) $but[$i][1] = IniRead($ini,$var[$i],"path","error") ConsoleWrite("Found " & $var[$i] &" at "& $but[$i][1] & @crlf) Next GUISetState() while 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit for $i = 1 to $var[0] if $msg = $but[$i][0] then GUIDelete($gui) go($but[$i][1]) EndIf Next WEnd EndIf EndIf Func go($path) $path = StringReplace($path,"@scriptdir",@scriptdir) ConsoleWrite("Starting chrome with "& $path & @crlf) ShellExecute("chrome.exe",'--user-data-dir="'&$path&'"') Exit EndFuncAny comments / suggestions welcome. Edited March 28, 2010 by corgano 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e
corgano Posted March 26, 2010 Author Posted March 26, 2010 No comments? Has anyone tested it? Or does no one care about chrome? 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e
James Posted March 27, 2010 Posted March 27, 2010 I think I've used this before, I downloaded it from a guy who also used AutoIt to make a portable "sandbox" for it. Looks similar? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
corgano Posted March 27, 2010 Author Posted March 27, 2010 His was this: ShellExecute("chrome.exe",'--user-data-dir="profil"') The purpose of my version was to function as a portable launcher for one person, or to allow multiple people to use it and have there settings in a different place (such as a second HDD in case of a reinstall, chrome and their settings would be safe) 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e
corgano Posted March 28, 2010 Author Posted March 28, 2010 New version! I completely rewrote it to be more user friendly. -Now it is cleaner, Folder structure is better (folder contains data folder, chrome folder, and launcher. This allows easy updateing / backing up). -The "Select user" box always opens, and there are add and delete buttons for your convenience. -Ini file is no longer used and is removed. Further comments welcome 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e
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