If this is to be the case, the request for support of WM_COPYDATA to send/receive message from TC would resolve this issue (in the thread referenced above), and would be very appreciated.
That way a defined list of messages (strings) could be defined - much like TC has defined a plugin interface.
Example possible strings:
-> Query_SrcPanelID
-> Query_LeftPanelID
-> Query_SrcPath
-> Query_ActiveTabName
-> Query_ButtonBarID
etc.
I'm not positive, but I believe the SendMessage could put the ScriptHWND in the wParam position for TC to reference - so it can callback/respond, e.g.
---> SendMessage, 0x4a, %ScriptHWND%, &CopyDataStruct,, %TC_HWND%
CopyDataStruct is a memory reference which contains a "Query_" string. To which TC would reply with a WM_COPYDATA message that has a memory address that contains the requested data.
TC already accepts WM_COPYDATA messages, for EM_'s and CD's. If we could get this, it would be just a matter of defining a list of valid Query's that TC would reply to. Then any possible string/dataStruct that might be needed for scripting could be placed into TC's basic receiving function and it would reply to the calling scripts HWND with a WM_COPYDATA message.
Working Example WM_COPYDATA message to change TC's directory
Code: Select all
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
}
TC_EMC( cmd, wID="ahk_class TTOTAL_CMD", activateWin=FALSE, showMsg=FALSE )
{
TC_Activate( wID, activateWin, showMsg, cmd )
TC_SendWMCopyData( "EM", cmd, params:="", wID )
return
}
TC_CD@( wID, src="", trg="", params="", activateWin=TRUE )
{
if( activateWin )
WinActivate, % ( wID+0 ? "ahk_id " wID : wID )
TC_SendWMCopyData( "CD", cmd:=(src " `r" trg " "), params, wID )
return
}
Add this to a button for a quick test:
Code: Select all
;;
;; TC__CDTest.ahk
;;
TC_CD@( WinActive("ahk_class TTOTAL_CMD"), "C:\Program Files", "C:\Users", "ST")