2015-04-05 58 views
1

我已經看到了這個示例代碼,以確定鈣鍵..如何使用的AutoIt

Run("Calc.exe") 
WinWaitActive("Calculator") 
WinActive("Calculator") 
Sleeper() 
ControlClick("Calculator", "", "Button5", "Left") ;Click the number 1 
Sleeper() 
ControlClick("Calculator", "", "Button11", "Left") ;Click the number 2 
Sleeper() 
ControlClick("Calculator", "", "Button23", "Left") ;Click the + button 
Sleeper() 
ControlClick("Calculator", "", "Button16", "Left") ;Click the number 3 
Sleeper() 
ControlClick("Calculator", "", "Button28", "Left") ;Click the Equal button 
Func Sleeper() 
    Sleep(1000) 
EndFunc 

前幾行確定。但其他線路按鈕5,按鈕11,等等,如果我們從左側數到它正在越來越正確..

而是,有沒有任何命令發送(25),發送(+),發送(20)發送(「= 「)...

+0

運行(」 的calc.exe「) WinWaitActi VE( 「計算器」) WinActive( 「計算器」) 夢() 發送( 「29」) 夢() 發送( 「{+}」) 夢() 發送( 「4」) 夢之() 發送( 「=」) 夢() Func鍵夢() 睡眠(2000) ENDFUNC 此工作正常..任何其他方式??? – ChanGan 2015-04-05 08:07:25

回答

1

這是你在找什麼:

Run("Calc.exe") 
WinWaitActive("Calculator") 
;this way you dont have to write separate statements for each button 
ControlSend("Calculator", "", "#327701", "12345678") 
;but you will have to write the statement for selecting operator separately 
ControlClick("Calculator", "", "Button23", "Left") 
ControlSend("Calculator", "", "#327701", "356") 
ControlClick("Calculator", "", "Button28", "Left") 

編輯: #327701是:

enter image description here

+0

「#327701,它是什麼意思? – ChanGan 2015-04-06 05:20:55

+0

這就是你輸入後顯示的文字。看我的回答。 – LittlePanda 2015-04-06 05:38:05

+0

哦!太好了。如何識別這個不是?#327701 ??從你在哪裏拿這個??通過autoIt座標?? – ChanGan 2015-04-06 05:39:57