autohotkey實現自動totalcmd 8.52點擊未激活提示窗口


最近在學習totalcmd的一些使用,在一些博客裏面瞭解到 

http://thouls.lofter.com/post/20f634_d78725

還可以結合自動點擊的功能,由於自己的totalcmd的版本較高,因此他的代碼無法正常工作,作爲小白,嘗試修改下如何能夠使之發生效果


1. 首先是下載 autohotkey, 新建一個mystript.ahk


2. 修改後的代碼

#t::

Run D:\Program Files\totalcmd\TOTALCMD64.EXE

WinWait, ahk_class TNASTYNAGSCREEN
WinActivate , ahk_class TNASTYNAGSCREEN
;WinWaitActive , ahk_class TNASTYNAGSCREEN , , 0.5

ControlGetText, OutputVar, Window4, ahk_class TNASTYNAGSCREEN

;MsgBox %OutputVar%
if( OutPutVar == 3 )
{
	ControlClick, Button1, ahk_class TNASTYNAGSCREEN	
}else if( OutPutVar == 2 ){
	ControlClick, Button2, ahk_class TNASTYNAGSCREEN
}else{
	ControlClick, Button3, ahk_class TNASTYNAGSCREEN
}

return


由於對autohotkey一點都不瞭解


#t 是指使用 win + t 作爲快捷鍵

ahk_class TNASTYNAGSCREEN 這個control是通過 autohotkey程序裏面 autoit3 window spy


使用方法如下



這樣子獲取了 totalcmd的 wintile 爲 ahk_class TNASTYNAGSCREEN 

“請按下按鈕 2 啓動程序”, 發現2的位置的control 爲 classNN:window4

瞭解了這些後,就是把他們如何組裝起來了,

從 http://ahkcn.github.io/docs/Tutorial.htm 查看裏面的API吧,

由於新版的 totalcmd已經禁止了 熱鍵來實現按鈕的功能,即不能使用

ControlSend [, Control, Keys, WinTitle, WinText, ExcludeTitle, ExcludeText]
來實現,(如果這樣實現,會跳轉到一個 頁面 )http://www.ghisler.com/reactivate.htm 


然後想了下,應該換成鼠標點擊來替換下 (使用鼠標點擊的效果的時候,鼠標不能夠移動)

接口如下:

ControlClick [, Control-or-Pos, WinTitle, WinText, WhichButton, ClickCount, Options, ExcludeTitle, ExcludeText]

完成了全部的功能。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章