Created
August 3, 2023 11:55
-
-
Save valuex/90885a1bfecc4246d3523df9530cde5a to your computer and use it in GitHub Desktop.
Send Message to Total Commander
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Script name: SendTCCommand.ahk | |
; Sends a Total Commander command to a TC instance. | |
; Can be used from the scheduler for example. | |
; Specify the TC command as command line parameter for example: | |
; AutoHotkey.exe SendTCCommand.ahk cm_FtpNew | |
; Or if the script is compiled: | |
; SendTCCommand.exe cm_FtpNew | |
sCmdParam := %1% | |
SendTCCommand( sCmdParam ) | |
Return | |
; | |
; SendTCCommand 0.2 | |
; | |
; Function purpose: | |
; Sends a Total Commander internal command to a TC instance. | |
; It can be used to automate Total Commander. | |
; | |
; Parameters: | |
; xsTCCommand: The Total Commander internal command, see the list here: | |
; %COMMANDER_PATH%\TOTALCMD.INC | |
; xbWait: Whether to wait for the command to execute, | |
; or just post it and return. | |
; | |
; Usage example: | |
; SendTCCommand( "cm_RereadSource", False ) | |
; | |
SendTCCommand( xsTCCommand, xbWait:=1 ) | |
{ | |
loop Read COMMANDER_PATH . "TOTALCMD.INC" | |
{ | |
asCommands:=StrSplit(A_LoopReadLine,"=") | |
if (asCommands[1] = xsTCCommand) | |
{ | |
asCommandsValues:=StrSplit(asCommands[2],";") | |
Break | |
} | |
} | |
if !(asCommandsValues[1] > 0) | |
return | |
if (xbWait) | |
SendMessage(1075, asCommandsValues[1], 0, , "ahk_class TTOTAL_CMD") | |
else | |
PostMessage( 1075, asCommandsValues[1], 0, , "ahk_class TTOTAL_CMD") | |
} |
Is this for Autohotkey v2?
Yes. You can tell it by the syntax of Sendmessage.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is this for Autohotkey v2?