2
MVV
would you please detail a bit what is the data structure of sending em_command with parameters when the the string contain non-ascii characters.
it's ok to send unicode parameter by your tcfs2 with :
but I didn't know how to convert the command string. I am using AHK unicode with:
Code: Select all
F10::
TC_SendData( "em_cd E:\测试2\", "EM") ; EM_ it's defined in usercmd [em_cd] cmd=cd param=%A
return
F11::
TC_SendData(Chr(0xFEFF) "d:\tc\" "`r" Chr(0xFEFF) "E:\测试2\ビデオゲームミュージック\", "LR") ; CD Command: (SourceDir - TargetDir)
return
/*
TESTED AND WORKING ON: AHK_L v1.1.21.03 UNICODE X32 + Win7 X32 + TC 8.51a
-------------------------------------------------------------------------
TC_SendData("em_FOO" , "EM") ; User Command
TC_SendData("em_APPENDTABS C:\my.tab", "EM") ; User Command with parameters (usercmd.ini as following)
; [em_APPENDTABS]
; cmd=APPENDTABS
; param=%A
TC_SendData("cmd") ; Ask TC : (cmd one of the following varues:)
; A = Active Side
; LP = Left Path RP = Right Path
; LC = Left List Count RC = Right List Count
; LI = Left Caret Index RI = Right Caret Index
; LN = Left Name Caret RN = Right Name Caret
; SP = Source Path TP = Target Path
; SC = Source List Count TC = Target List Count
; SI = Source Caret Index TI = Target Caret Index
; SN = Source Name Caret TN = Target Name Caret
TC_SendData("C:\tc" "`r" "D:\data", "LR") ; CD Command: (LeftDir - RightDir)
TC_SendData("C:\tc" "`r" , "LR") ; CD Command: (LeftDir)
TC_SendData( "`r" "D:\data", "LR") ; CD Command: ( RightDir)
TC_SendData("C:\tc" "`r" "D:\data", "ST") ; CD Command: (SourceDir - TargetDir)
TC_SendData("C:\tc" "`r" , "ST") ; CD Command: (SourceDir)
TC_SendData( "`r" "D:\data", "ST") ; CD Command: ( TargetDir)
*/
TC_SendData(Cmd, CmdType="", msg="", hwnd="") {
Critical ; Define "OnMessage" as STATIC it is registered at Script startup.
STATIC om:=OnMessage(0x4a, "TC_SendData"), TC_ReceiveDataValue:="", TC_DataReceived:="" ; 0x4a is WM_COPYDATA
IF ((msg=0x4A) AND (hwnd=A_ScriptHwnd)) ; EnSure is trigered by this Script.
EXIT (TC_ReceiveDataValue:=StrGet(NumGet(CmdType + A_PtrSize * 2)), TC_DataReceived:="1")
VarSetCapacity(CopyDataStruct, A_PtrSize * 3), TC_ReceiveDataValue:=1, TC_DataReceived:=""
IF CmdType IN LR,ST ; CD Command
DirType:=CmdType, CmdType:="CD"
ELSE IF (CmdType="") ; Ask TC
CmdType:=(A_IsUnicode ? "GW" : "GA"), TC_ReceiveDataValue:=""
If( A_IsUnicode ) {
;;;;;;VarSetCapacity( cmdA, StrPut(cmd, "cp0"),0) ; 3rd parameter "0" is necessary for CD "LeftPath only"
VarSetCapacity(cmdA, StrPut(cmd, "UTF-8"), 0) , Len:=StrPut(cmd, &cmdA, "UTF-8")
; Loop, % StrLen(cmd)
;NumPut( Asc(SubStr(cmd, A_Index, 1)), cmdA, A_Index - 1, "Char")
}
else
Len:=StrLen(cmd)
; MsgBox, % len ; ansi 14 40 Unicode 22/80
NumPut( Asc(SubStr(CmdType,1,1)) + 256 * Asc(SubStr(CmdType,2,1)), CopyDataStruct,0 )
NumPut( Len + (CmdType="CD" ? 5 : 0) * (A_IsUnicode ? 2 : 1) , CopyDataStruct, A_PtrSize )
NumPut((A_IsUnicode ? &cmdA : &cmd), CopyDataStruct, A_PtrSize * 2)
Loop, % (CmdType=="CD" ? 2 : 0)
NumPut(Asc(SubStr(DirType,A_Index,1)), (A_IsUnicode ? cmdA : cmd),Len+A_Index-1, "Char")
SendMessage, 0x4A,%A_ScriptHwnd%, &CopyDataStruct,, ahk_class TTOTAL_CMD
While (TC_ReceiveDataValue="") {
IfEqual, TC_DataReceived, 1, Break
IfGreaterOrEqual, A_Index, 500, Break
Sleep,10
}
Return TC_ReceiveDataValue
}
or is there any tool can capture the actual data sent to TC? Then (maybe) I can capture the tcfs2 sent data and figure how by myself