MilesAhead Posted August 13, 2008 Posted August 13, 2008 I like to use FreeCommander file manager. As yet afaik there's no command line option to launch it with the desired Layout. (A Layout is a configuration of folder tabs saved as a name, which when clicked will open all tabs as layed out in the Layout.) AutoIt3 being perfect for such a job I made a trivial script to open FreeCommander if not already running and open the desired Layout. (You can of course enhance it to read params from the command line for which layout to open or whatever.) #cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.12.1 Author: MilesAhead Script Function: launch FreeCommander then open particular Layout. Note that Send("!2") sends Alt+2 to the active window. Change the Alt key combination to open the Layout you want. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here Opt("WinTitleMatchMode", 2) ;use path to FreeCommander.exe on your machine $freeCommander = "C:\Program Files\FreeCommander\FreeCommander.exe" If Not ProcessExists("FreeCommander.exe") Then ShellExecute($freeCommander) Else WinActivate("FreeCommander") EndIf WinWaitActive("FreeCommander") Send("!2") Exit My Freeware Page
MilesAhead Posted August 14, 2008 Author Posted August 14, 2008 I dressed it up a bit. Assuming FreeCommander.exe is under C:\Program Files is not good since there may actually be a copy there on a multiboot machine, but it may not be the one you want to use. I changed it to bring up a file open dialog and let the user choose the FreeCommander.exe, saving the result in an .ini file. Also I changed the sent key combo to "!1" since that should be the default Layout if there is one. The next enhancement would be to use the .ini file and/or command line to select a different layout. expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.12.1 Author: MilesAhead Script Function: launch FreeCommander then open particular Layout. Note that Send("!1") sends Alt+1 to the active window. Change the Alt key combination to open the Layout you want. #ce ---------------------------------------------------------------------------- ; match any substring Opt("WinTitleMatchMode", 2) $freeCommander = "" If Not _Init_FreeCommander($freeCommander) Then Exit EndIf If Not ProcessExists("FreeCommander.exe") Then ShellExecute($freeCommander) Else WinActivate("FreeCommander") EndIf WinWaitActive("FreeCommander") Send("!1") Exit Func _Init_FreeCommander(ByRef $fcExeFile) $iFile = @ScriptDir & "\FreeCommanderLayout.ini" $fname = IniRead($iFile, "FCFileName", "FreeCommander", "NotFound") If $fname <> "NotFound" Then $fcExeFile = $fname Return True EndIf $fname = FileOpenDialog("Select FreeCommander exe File", @ProgramFilesDir, "Executables (*.exe)", 1 + 2, "FreeCommander.exe") If @error Then Return False EndIf IniWrite($iFile, "FCFileName", "FreeCommander", $fname) $fcExeFile = $fname Return True EndFunc ;==>_Init_FreeCommander My Freeware Page
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