本帖最后由 happytc 于 2011-1-13 08:26 编辑
如,TotalCommander(TC)程序的Alt+F6是给文件解压的热键,我想自动化TC这个解压出来的窗口,在au3里同样设Alt+F6,代码如下,但时灵时不灵的,换成别的TC没有的热键(#z),就正常了,这要为什么?HotKeySet("!{F6}", "TCUnpackSameDir")
While 1
Sleep(100)
WEnd
Func TCUnpackSameDir()
Local $TCclass1, $TCclass2, $TCControl1, $TCControl2, $Info, $Val
$Val = "cm_UnpackFiles" & @CR
$TCclass1 = "[CLASS:TTOTAL_CMD]"
$TCclass2 = "[CLASS:TDLGUNZIPALL]"
$TCControl1 = "TAltEdit1"
$TCControl2 = "TCheckBox1"
$TCControl3 = "TButton4"
ControlSend($TCclass1, "", "Edit1", $Val)
If WinWaitActive($TCclass2) Then
Do
Send("{DEL}")
$Info = ControlGetText($TCclass2, "", $TCControl1)
Until Not $Info
ControlCommand($TCclass2, "", $TCControl2, "Check")
ControlClick($TCclass2, "", $TCControl3)
EndIf
EndFunc
而在AHK里做同样的事,只要下面的代码,就完全正常了,怎么在au3里也可以完全抢程序热键SetTimer subTimer, 246
subTimer:
$!F6::
IfWinActive ahk_class TTOTAL_CMD
{
PostMessage, 1075, 509
WinWaitActive, ahk_class TDLGUNZIPALL
Send, {Del}
Control, Check, , TCheckBox1
Send, {Enter}
}
else
Send !{F6}
return
|