I try to add a hot key for this function:
cd a special folder, then switch to a custom view.
I know there are 2 TC internal command "CD" and "OPENCUSTOMVIEW", but I don't know how to combine them together.
for some normal TC command, I can write a AHK file like this:
PostMessage 1075, XXXX, , , ahk_class TTOTAL_CMD
PostMessage 1075, YYYY, , , ahk_class TTOTAL_CMD
it will do 2 TC command.
however, "CD" and "OPENCUSTOMVIEW" are special,
CD <directory>=-2
OPENCUSTOMVIEW <view name>=-10
it seems I can't use postmessage for them, so I don't know whether there is any other way to do this.
how can I execute 2 tc internal command with one hot key?
Moderators: Hacker, petermad, Stefan2, white
1. You can use WM_COPYDATA message (read history.txt for details, also there were some topics on this board) to send CD command and user-commands (OPENCUSTOMVIEW may be packed into user-command - theese are kept in usercmd.ini and may be created via command browser cm_CommandBrowser).
2. You can use TCMC tool to send CD command and execute user-commands. E.g.:
(note s suffix for CD command - it changes source/target instead of left/right, and you must specify both left and right, so I use empty quotes for target dir)
2. You can use TCMC tool to send CD command and execute user-commands. E.g.:
Code: Select all
Command: TCMC.exe
Parameters: CDs "c:\Boot" "" EMem_OpenMyCustomView
-- Addition to MVVMVV wrote:1. You can use WM_COPYDATA message (read history.txt for details, also there were some topics on this board) to send CD command and user-commands (OPENCUSTOMVIEW may be packed into user-command - theese are kept in usercmd.ini and may be created via command browser cm_CommandBrowser).
2. You can use TCMC tool to send CD command and execute user-commands. E.g.:(note s suffix for CD command - it changes source/target instead of left/right, and you must specify both left and right, so I use empty quotes for target dir)Code: Select all
Command: TCMC.exe Parameters: CDs "c:\Boot" "" EMem_OpenMyCustomView
If you want to use CD, OPENCUSTOMVIEW,... from script. You can create custom command like em_CD, em_opencustomview, em_selectfiles... where you set the TC command as command and %A as parameter.
After you just have to use sendcopydata to TC main window with message 0x4D45 and "em_cd c:\test" or "em_cd *.exe *.cmd" or "em_opencustomview EXEFILES" as copy data string.
I attemp to write a autohotkey script in order to send a em_xx cmd to TC, unfortunately it didn't work, anybody can tell me what is the problem in my code?
PS: I am using autohotkey_L 1.1.08.01 x64, and Total commander 8.01 rc5 X64
em_cmd file
PS: I am using autohotkey_L 1.1.08.01 x64, and Total commander 8.01 rc5 X64
Code: Select all
#NoTrayIcon
#SingleInstance force
SetBatchLines -1
SendMode, Input
TC_SendWMCopyData("EM", "em_test", "", "ahk_class TTOTAL_CMD")
return
TC_SendWMCopyData( cmdType, byRef cmd, byRef addParams="", aWin="A" )
{
Critical
VarSetCapacity( CopyDataStruct, A_PtrSize * 3 )
if( A_IsUnicode )
{
VarSetCapacity( cmdA, StrPut(cmd, "cp0"))
Loop, % StrLen(cmd)
NumPut( Asc(SubStr(cmd, A_Index, 1)), cmdA, A_Index - 1, "Char")
}
NumPut( Asc(SubStr(cmdType,1,1)) + 256 * Asc(SubStr(cmdType,2,1)), CopyDataStruct )
NumPut( StrLen(cmd) + (cmdType="CD" ? 5 : 1), CopyDataStruct, A_PtrSize )
NumPut((A_IsUnicode ? &cmdA : &cmd), CopyDataStruct, A_PtrSize * 2)
Loop, % (cmdType=="CD" ? 2 : 0)
NumPut( Asc(SubStr(addParams, A_Index, 1)), (A_IsUnicode ? cmdA : cmd), (StrLen(cmd) + A_Index), "Char" )
SendMessage, 0x4A,, &CopyDataStruct,, ahk_id %aWin%
return
}
Code: Select all
[em_test]
button=
cmd=notepad
- Balderstrom
- Power Member
- Posts: 2148
- Joined: 2005-10-11, 10:10 UTC