Jump to a specified file immediately after start
Moderators: white, Hacker, petermad, Stefan2
Jump to a specified file immediately after start
Currently, one can only specify the folder in which TC must start in. I think it would be useful if TC could be started with focus on a file specified in the command line, like
totalcmd.exe c:\autoexec.bat
What do you think?
totalcmd.exe c:\autoexec.bat
What do you think?
Hello azazell0,
yes, would be wonderful! It needs a "start at file" command line parameter for TC and a new internal command ("cm_GotoNamedFile" for instance... yes, I know: "cm_" commands doesn't accept parameters, so it should be implemented like "ftpopen" or "opentabs"?) too. AFAIR, this requirement has been already discussed several times in this forum.
As a workaround, you can call TC by this AutoIT-script, which originally was written to jump to a specific file in TC from within "Locate32":
Usage (if not started ba hotkey from Locate32):
LocateAndJump[.exe] "Z:\Path\To\File.ext"
Or
[X:\Path\To\]AutoIT.exe [Y:\Path\To\]LocateAndJump.au3 "Z:\Path\To\File.ext"
To pass through other command line parameters to TC, the script should be slightly modified. If you like to try a compiled standalone-version of this script, just ask for it here.
yes, would be wonderful! It needs a "start at file" command line parameter for TC and a new internal command ("cm_GotoNamedFile" for instance... yes, I know: "cm_" commands doesn't accept parameters, so it should be implemented like "ftpopen" or "opentabs"?) too. AFAIR, this requirement has been already discussed several times in this forum.
As a workaround, you can call TC by this AutoIT-script, which originally was written to jump to a specific file in TC from within "Locate32":
Code: Select all
;====================================================================================================
;LocateAndJump, van Dusen. 2006-01-31
;Script for AutoIT3 (http://www.autoitscript.com/autoit3/)
;Settings for Locate32:
;Menu Settings, Dialog "Settings:", Tab "Keyboard Shortcuts":
; Shortcut: Key: STRG + F
; Advanced: Advanced Settings: Type: Local
; Where pressed: Result list
; Action: Action: Advanced
; Action: SubAction: Execute Command
; Action: Command: C:\Programme\AutoIt3\AutoIt3.exe C:\Programme\TotalCmd\Tools\LocateAndJump.au3 "%d"
; (Locate32 seems not to decode environment variables like "%ProgramFiles%")
;Usage:
;Find a file wth Locate32, press STRG+F to open the containing dir in TC and to jump to the located file
;====================================================================================================
$fullname = $CmdLine[1]
$fullname_tok = StringSplit($fullname, "\")
$filename = $fullname_tok[$fullname_tok[0]]
$pathname = StringLeft($fullname, StringLen($fullname) - StringLen($filename) - 1)
Run(@ProgramFilesDir & "\TotalCmd\TotalCmd.exe /O /T /S /L=" & Chr(34) & $pathname & Chr(34), "")
;*** cm_ShowQuickSearch=2915;Show name search window
Sleep(250)
DllCall("user32.dll", "int", "SendMessage", "hwnd", WinGetHandle("Total Commander"), "int", 1075, "int", 2915)
Send($filename, 1)
Send("{ESC}")
;Send("{SPACE}")
LocateAndJump[.exe] "Z:\Path\To\File.ext"
Or
[X:\Path\To\]AutoIT.exe [Y:\Path\To\]LocateAndJump.au3 "Z:\Path\To\File.ext"
To pass through other command line parameters to TC, the script should be slightly modified. If you like to try a compiled standalone-version of this script, just ask for it here.
Sorry for answering late...
The command line switch /S in TotalCmd.exe /O /T /S /L="{path}" alters the meaning of the /L and /R switches: If /S is present, then /L references the "active panel" instead of the "left panel" and /R means "inactive panel" instead of "right panel".
BTW: The /T switch seems not to work... it should open the given path in a new tab, but it doesn't do so.
Here is a modified script. It waits for the TC window (timeout after 5s) and the quick search edit box (timeout after 2s), thus the Sleep statement should be unnecessary. In case of a timeout the script tries to play a sound; this is just a gimmick - you can delete both Else and SoundPlay code lines, if you like:
The command line switch /S in TotalCmd.exe /O /T /S /L="{path}" alters the meaning of the /L and /R switches: If /S is present, then /L references the "active panel" instead of the "left panel" and /R means "inactive panel" instead of "right panel".
BTW: The /T switch seems not to work... it should open the given path in a new tab, but it doesn't do so.
Here is a modified script. It waits for the TC window (timeout after 5s) and the quick search edit box (timeout after 2s), thus the Sleep statement should be unnecessary. In case of a timeout the script tries to play a sound; this is just a gimmick - you can delete both Else and SoundPlay code lines, if you like:
Code: Select all
AutoItSetOption("WinTitleMatchMode", 4)
;AutoItSetOption("SendKeyDelay", 10)
$fullname = $CmdLine[1]
$fullname_tok = StringSplit($fullname, "\")
$filename = $fullname_tok[$fullname_tok[0]]
$pathname = StringLeft($fullname, StringLen($fullname) - StringLen($filename) - 1)
;Run(@ProgramFilesDir & "\TotalCmd\TotalCmd.exe /O /T /S /L=" & Chr(34) & $pathname & Chr(34), "")
Run(@ProgramFilesDir & "\TotalCmd\TotalCmd.exe /O /T /L=" & Chr(34) & $pathname & Chr(34), "")
If WinWait("classname=TTOTAL_CMD", "", 5) Then
;*** cm_ShowQuickSearch=2915;Show name search window
DllCall("user32.dll", "int", "SendMessage", "hwnd", WinGetHandle("classname=TTOTAL_CMD"), "int", 1075, "int", 2915)
If WinWaitActive("classname=TQUICKSEARCH", "", 2) Then
Send($filename, 1)
Send("{ESC}")
;Send("{SPACE}")
Else
SoundPlay(StringReplace(RegRead("HKCU\AppEvents\Schemes\Apps\.Default\SystemAsterisk\.Current", ""), "%SystemRoot%", @WindowsDir), 1)
EndIf
Else
SoundPlay(StringReplace(RegRead("HKCU\AppEvents\Schemes\Apps\.Default\SystemAsterisk\.Current", ""), "%SystemRoot%", @WindowsDir), 1)
EndIf
2van Dusen
http://www.ghisler.ch/board/viewtopic.php?t=9434
maybe this is related to:The /T switch seems not to work... it should open the given path in a new tab, but it doesn't do so.
http://www.ghisler.ch/board/viewtopic.php?t=9434