1

システムにレコードを入力するためのスクリプトがあり、元々は MsgBox で正常に機能していましたが、レコード エントリを表示する GUI を追加しました。これで、スクリプトは最初のレコードの後で停止します。

以下の例では、解析しやすくするためにすべてのアクションとレコード行を削除していますが、重要なものはすべて残して、このバージョンのスクリプトをテストしています。

Loop, read, C:\_AutoHotKey\AA_test.txt
{
    StringSplit, LineArray, A_LoopReadLine, %A_Tab%

    aaduedate   := LineArray1
    aauniqueid  := LineArray2
    aaprefix    := LineArray3
    aasequence  := LineArray4
    aadescript  := LineArray5
    aaelig      := LineArray6

;-------------------------------------------------------------------------------------
;Use these to test the file match in the Input File.
;Remove surrounding comments and surround the rest of the script up to the last brace.
    SendInput, Prefix: %aaprefix% {enter}
    SendInput, Sequence: %aasequence% {enter}
    SendInput, Description: %aadescript% {enter}
    SendInput, Eligibility: %aaelig% {enter}
    SendInput, ID Card: %aaidcard% {enter}
;---------------------------------------------------------------------------------------

;Pop-up validation menu
Gui, Add, Button, x22 y380 w100 h30 , &Submit
Gui, Add, Button, x362 y380 w100 h30 , &Cancel
Gui, Font, S14 CDefault, Verdana
Gui, Add, Text, x152 y10 w210 h30 +Center, Is the entry correct?
Gui, Font, S10 CDefault, Verdana
Gui, Add, Text, x102 y40 w90 h20 , %aaprefix%
Gui, Add, Text, x102 y70 w130 h20 , %aaelig%
Gui, Add, Text, x312 y70 w30 h20 , %aadescript%
Gui, Add, Text, x432 y70 w30 h20 , %aaidcard%
Gui, Font, S8 CDefault, Verdana
Gui, Add, Text, x132 y380 w230 h40 +Center, Click Submit/press S to continue. Click cancel to stop script.
; Generated using SmartGUI Creator 4.0
Gui, Show, x9 y250 h428 w480, Auto Action Validation
Return

ButtonCancel: 
ExitApp

ButtonSubmit: 
Gui, Submit ; 
    MouseMove, 630,55
    Sleep, 100
    SendInput, {Click 630,55}
    SendInput ^S

Return

}

ボタンは機能し、[送信] をクリックすると、MouseMove と SendInput が送信されます。しかし、その後は停止するだけで、テキスト ファイルの次のレコードは読み込まれません。

前もって感謝します!

4

2 に答える 2

0

GUI から送信ボタンを削除し、MsgBox に移動することで、これを機能させることができました。

GUI は基本的に同じですが、Submit 行と Cancel 行が削除され、返品とそれに続くすべてのロジックが削除されています。

次に、データを確認するために MsgBox を追加しました。これは、GUI を使用してレコードの内容を表示し、MsgBox を使用して確認して次のレコードに移動します。

また、受信アプリのデータ入力画面をブロックしないように MsgBox を移動する、私が盗んだ (そしてあまり理解していない) コードがいくつかあります。

これは、Gui、Show、x9 の後のすべてを置き換える新しいコードです...

OnMessage(0x44, "WM_COMMNOTIFY")
MsgBox 4, AA Entry, Would you like to continue? (press Yes or No)

WM_COMMNOTIFY(wParam) {
    if (wParam = 1027) { ; AHK_DIALOG
        Process, Exist
                DetectHiddenWindows, On
        if WinExist("ahk_class #32770 ahk_pid " . ErrorLevel) {
            WinGetPos,,, w
            WinMove, 90, 650
        }
    }
    }
;If the user responds yes, then close the Gui (Destroy) and enter the record
IfMsgBox Yes
    {
        Gui destroy
        Sleep, 100
}
    else
        ExitApp

}

ありがとう、そしてこれが誰かに役立つことを願っています。

于 2013-09-01T06:11:46.743 に答える