TC 8 x64, Scripting Problems (Element Class Names)

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

TC 8 x64, Scripting Problems (Element Class Names)

Post by *Balderstrom »

Back in this thread new messages for TC scripting/ More Automation possibilities - there were some enhancement requests to enable easier interaction with TC from external (or ButtonBar) scripts. In TC 8 x64 things have deteriorated.

If it is at all possible before TC 8 goes final, could disctinctive classnames (Please) be added for the various window elements - that can be easily referenced.

Example: All of the controls in TC's window except for the ListBoxes, DriveCombos and CommandLine have a class of "Window"...

Code: Select all

                     Window ClassNames
                  In TC 7.x       TC 8 x64
ButtonBar     ->  TButtonBar      Window
DrivePanel    ->  TDrivePanel     Window
DriveComboBox ->  TMyComboBox     LCLComboBox
DriveSizeInfo ->  TMyPanel        Window
Tab Control   ->  TMyTabControl   Window
Tabs          ->  TMyPanel        Window
AddressBar    ->  TPathPanel      Window
TabStops      ->  THeaderClick    Window
FilePanels    ->  TMyListBox      LCLListBox
StatusBar     ->  TMyPanel        Window
PathField     ->  TMyPanel        Window
CommandLine   ->  Edit            Edit
FunctionBar   ->  TMyPanel        Window
Further in TC 7.x - one could usually deduce which control the TMyPanel was referring to by its control number and/or it's text content.
User avatar
Samuel
Power Member
Power Member
Posts: 1930
Joined: 2003-08-29, 15:44 UTC
Location: Germany, Brandenburg an der Havel
Contact:

Post by *Samuel »

Support++

However it seems to be a harder task:
http://www.ghisler.ch/board/viewtopic.php?t=31130
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

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

Command: TC__CDTest.ahk

Code: Select all

;;
;; TC__CDTest.ahk
;;
TC_CD@( WinActive("ahk_class TTOTAL_CMD"), "C:\Program Files", "C:\Users", "ST")
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

Year 3 bump.
*BLINK* TC9 Added WM_COPYDATA and WM_USER queries for scripting.
Post Reply