elgonzo wrote:Please be aware that the 64bit version of TC uses different window class names than the 32bit version. Thus, your AutoHotScript as it is now will not work for both 32bit and 64bit versions of TC.
Anyway, i did a quick check with AutoHotKey's Window Spy and the 32bit version of TC.
I guess you want to get the path string from the label left of the command line, right? If so, try querying TMyPanel3 (TMyPanel2 is just the parent container of this label, hence querying TMyPanel2 will get you no text). Note that the string contains a ">" as last character which you have to remove before passing the string to the GetFolder() function...
I'm using a 32bit version of TC. Thanks for the hint about AutoHotKey's Window Spy. I replaced the TMyPanel2 with TMyPanel3 and added
StringMid sPath, sPath, 1, StrLen(sPath) -1 and it worked.
Here's the final version of the code for anyone interested:
Code: Select all
#IfWinActive, ahk_class TTOTAL_CMD
; Multi-rename files
F1::
ControlGetText sPath, TMyPanel3
StringMid sPath, sPath, 1, StrLen(sPath) -1
Send, ^m
Sleep, 100
NumberOfFiles = % ComObjCreate("Scripting.FileSystemObject").GetFolder(sPath).Files.Count
Send, {F2}
if (NumberOfFiles > 999) {
Send, 4
}
else {
Send, 3
}
Sleep, 100
Send, !o
Return
#IfWinActive