2011-11-08 5 views
0

を自動化:AutoHotkeyを勝利XPは私がAutoHotkeyをして自動化したい小さなタスクを持っており、それはAutoHotKeyの構文に多かれ少なかれ直接的に転写可能であるように見える小さなタスク

1. Ctrl+v 
2. Alt+tab 
3. Click certain link in a window (no combo-key for this but it's always in the same place) 
4. Enter (carriage return) 
5. Alt+s 
6. Ctrl+v 
7. Enter 

今ではマップするためにいいだろう他の何かにこのコンボWindowsキー+スペース。

私がこれまで持っていることである。これは約右

0. SetWinDelay 100 (using a connection to an remote computer) 
0. SetKeyDelay 0 
1. Send, ^c 
1. ClipWait, 0.1 
2. Send, {Alt down}{tab} 
2. Send, {Alt up} 
3. ????? 
4. Send, {enter} 
5. Send, !s 
6. Send, ^v 
7. Send, {enter} 

ですか?

また、手順3,4,5の別の方法は、クリップボードの内容(数字列)をループして、それぞれを送信することですキーストーンの文字列?これは簡単な方法でしょう

答えて

1

特定の位置を「クリック」したい場合は、メニューを開くために、まずAutoHotKeyアイコンを右クリックし、「ウィンドウスパイ」を開きます。このウィンドウのスパイはマウスの位置を表示します。 Yoは、アクティブなアプリケーションでマウスの位置を使用してアクションを実行できます。

例:この場合

SoundBeep 1000, 300 ; Wake up user 

SplashTextOn, 200, 100, Script Preparations, Please Click on the person icon link. ; Show new Instructions text 

WinMove, Script Preparations,, (A_ScreenWidth/2)+150, (A_ScreenHeight/2)+200 ; Move the window with the name "Script Preparations" Down and Right on the main screen 

KeyWait, LButton, D ; Wait for LeftMouseButton click Down 

MouseGetPos, xposE ,yposE ; Store the position where the mouse was clicked (Employee) 

MouseClick, left, %xposE% ,%yposE%, 2 ; Perform a double mouse click on the captured mouse location 

SplashTextOff ; Remove Text box 

、私が最初に手動で適切な場所をクリックするようユーザーに尋ねます。これは、クリックする位置がアクティブなウィンドウ(アクティブなウィンドウ内の可変のタイル)内で変化する場合にのみ必要です。ポジションを保存したら、スクリプト全体ですべてを再利用することができます。

b.t.w.代わりにAltキー + タブを使用して、私はこれを使用することをお勧め:

settitlematchmode, 1 ; Set search in title to start with.... 

settitlematchmode, Fast ; Slow is not required here. Slow is only required when hidden text needs to be found. 

SwitchWindow("Microsoft Excel - 1 QRM Upload and Change Template") ; Activate the 
window with the title: Microsoft Excel - 1 QRM Upload and Change Template 

You could even use someting like this: 

SetTitleMatchMode, 2 ; Ensure that the Title Match mode is set to 2: Find anywhere in the title 

    SetTitleMatchMode, Fast ; Ensure that the Title Match mode is set to FAST 

    winactivate, %WindowName% ; Activate the window with the title stored in the variable WindowName 

    WinWaitActive, %WindowName%, , 5 ; Wait up to five seconds for the screen 

    if ErrorLevel ; Execute this when the window is not activated within 5 seconds 

    { ; Start-If Wait failed 

    SoundBeep 1000 , 1000 ; Warn the user 

    MsgBox,4097,Time Out, Script timed out while waiting for %WindowName%.`n`rYou Must manually activate %WindowName% and then continue the script by pressing OK. ; Message to user 

    IfMsgBox, Cancel ; Do when the user clicked on Cancel 

    { ; Start-If User clicked Cancel 

     ExitApp ; Exit this program when the user clicked on Cancel 

    } ; End-If User clicked Cancel 

    WinWaitActive, %WindowName%, , 5 ; Try to activate the window AGAIN 

    if ErrorLevel ; If window can't be found 

    { ; Start-If window can't be found 

     MsgBox,4096,Exit, %WindowName% still NOT Active. ; Warn user 

     ExitApp ; Exit this program when the expected window is still not found 

    } ; End-If window can't be found 

    } ; End-If Wait failed 

よろしく、

ロバートIlbrink

+0

感謝。 WinActivateが便利になり、多くの「Send」が使い終わった後に私はいくつかの睡眠を取った。クリップボードの内容が '擬似貼り付け'されている可能性があるため、マウスのクリックを使用して貼り付けモードを変更しませんでした。 '%クリップボード%' – abcde123483

関連する問題