Jump to content

Recommended Posts

Posted (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 place

How 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 launch

New code:

#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)
EndFunc

No INI's or files to mess around with. It's just that easy

The 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 it

What 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\foldercanbeanywere

And the code:

#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
EndFunc

Any comments / suggestions welcome.

Edited by corgano

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Posted

No comments? Has anyone tested it? Or does no one care about chrome?

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Posted

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

Posted

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...