2017-03-28 7 views
2

私の現在のGUIには、一度クリックすると他のGUIが表示され、スクリプトを使って情報を入力するための情報を入力するボタンがあります。いったんボタンを押すと、それはいつものように機能しますが、ポップアップGUIに情報を入力すると、メインGUIも同様に反応します。これは組み込みのIEブラウザであり、ユーザーの入力を受け取ったため、それはすべてを台無しにする。AutoitでメインGUIを無効にする方法

ここに現在のコードがあります。

ご協力いただければ幸いです!

#include <ButtonConstants.au3> 
#include <EditConstants.au3> 
#include <GUIConstantsEx.au3> 
#include <WindowsConstants.au3> 
#include <StaticConstants.au3> 
#include <ComboConstants.au3> 
#include <WinHttp.au3> 
#include <IE.au3> 
#include <GUIConstantsEx.au3> 
#include <GuiEdit.au3> 
#include <WinAPIFiles.au3> 
#include <ImageSearch2015.au3> 

Opt('SendKeyDelay', Random (16,80)); default 5. higher number = slower 
Global $nameInfo = IniRead('Userinfo.ini', 'Name', 'Name', 'No username on file') 
Global $passInfo = IniRead('Userinfo.ini', 'Pass', 'Pass', 'No password on file') 
Global $slpMed = Random (2000, 2500) 
Global $slpLow = Random (100, 350) 

;Not in use ATM, will be used in future builds. 
Global $en = '....' ;Need to find out how to login through world # 
Global $mainUrl = 'https://' & $en & '.******' 
Global $testUrl = 'https://*********' 

Main_GUI() 

Func Main_GUI() 
AutoItSetOption ("MouseCoordMode", 0) 
$EzTw = GUICreate("Ez Tw", 885, 513, -1, -1) 
GUISetBkColor(0xA0A0A0) 
$Username = GUICtrlCreateInput($nameInfo, 8, 32, 105, 21) 
GUICtrlSetBkColor(-1, 0xFFFFFF) 
$Password = GUICtrlCreateInput($passInfo, 120, 32, 105, 21) 
GUICtrlSetBkColor(-1, 0xFFFFFF) 
$LogBtn = GUICtrlCreateButton("Login", 24, 56, 75, 17) 
GUICtrlSetBkColor(-1, 0xFFFFFF) 
$UserT = GUICtrlCreateLabel("User name", 40, 8, 55, 17) 
$PassT = GUICtrlCreateLabel("Password", 144, 8, 50, 17) 
$SaveBtn = GUICtrlCreateButton("Save Info", 136, 56, 75, 17) 
GUICtrlSetBkColor(-1, 0xFFFFFF) 
$Group1 = GUICtrlCreateGroup("Group1", -16, -40, 257, 129) 
GUICtrlCreateGroup("", -99, -99, 1, 1) 
$Group2 = GUICtrlCreateGroup("Group2", 240, -16, 265, 105) 
$btnAxeLc = GUICtrlCreateButton("Axe/LC", 248, 32, 75, 17) 
$btnLcHc = GUICtrlCreateButton("Lc/Hc", 248, 8, 75, 17) 
$btnSpHc = GUICtrlCreateButton("Sp/Hc", 248, 56, 75, 17) 
$btnSwAc = GUICtrlCreateButton("Sw/Ac", 336, 8, 75, 17) 
$btnAxe = GUICtrlCreateButton("Axe Only", 336, 32, 75, 17) 
$btnSpear = GUICtrlCreateButton("Spear Only", 336, 56, 75, 17) 
$btnArcher = GUICtrlCreateButton("Archer Only", 424, 8, 75, 17) 
$btnSword = GUICtrlCreateButton("Sword Only", 424, 32, 75, 17) 
$btnMounted = GUICtrlCreateButton("MA Only", 424, 56, 75, 17) 
Global $ie = _IECreateEmbedded() 
Global $inIW = GUICtrlCreateObj($ie, 10, 100, 865, 405) 
With $ie 
.navigate ("*******") 
EndWith 
GUISetState(@SW_SHOW) 

While 1 
    $nMsg = GUIGetMsg() 
    Switch $nMsg 
     Case $GUI_EVENT_CLOSE 
      Exit 
     Case $saveBtn 
      $User = GUICtrlRead($Username) 
      IniWrite("Userinfo.ini", "Name", "Name", $User) 
      $Pass = GUICtrlRead ($Password) 
      IniWrite("Userinfo.ini", "Pass", "Pass", $Pass) 
     Case $logBtn 
      $User = GUICtrlRead($Username) 
      $Pass = GUICtrlRead ($Password) 
      With $ie 
       While ($ie.busy) 
       WEnd 
       Sleep ($slpLow) 
       $txtUser = .document.getElementById('user') 
       $txtUser.value = $User 
       Sleep ($slpLow) 
       $txtPass = .document.getElementById('password') 
       $txtPass.value = $Pass 
       Sleep ($slpLow) 
      For $a In _IETagNameGetCollection($ie, "a") 
       If StringInStr(_IEPropertyGet($a, "innerText"), "Login") Then 
         $a.fireEvent("onmousedown") 
         sleep ($slpLow) 
         $a.fireEvent("onmouseup") 
         _IEAction($a, "click") 
       EndIf 
      Next 
      Sleep ($slpMed) 
       EndWith 

     Case $btnAxeLc 
       call ('AxeLcGUI') 



     Case $btnLcHc 

     Case $btnSpHc 

     Case $btnSwAc 

     Case $btnArcher 

     Case $btnAxe 

     Case $btnSpear 

     Case $btnSword 

     Case $btnMounted 

    EndSwitch 
WEnd 
EndFunc 

Func AxeLcGUI() 
$axeInfo = IniRead('Userinfo.ini', 'AxeLC', 'Axe', 'Not on file') 
$lcInfo = IniRead('Userinfo.ini', 'AxeLC', 'LC', 'Not on file') 
$LcForm = GUICreate("Axe/Lc", 315, 134, -1, -1) 
$AxNum = GUICtrlCreateInput($axeInfo, 32, 40, 73, 21) 
$AxNumT = GUICtrlCreateLabel("How Many Ax/run?", 24, 16, 96, 17) 
$LcNum = GUICtrlCreateInput($lcInfo, 176, 40, 73, 21) 
$LcNumT = GUICtrlCreateLabel("How many LC/run?", 168, 16, 96, 17) 
$LootAssist = GUICtrlCreateButton("Loot Assist", 32, 88, 75, 25) 
$btnSave = GUICtrlCreateButton("Save Info", 176, 88, 75, 25) 
GUISetState(@SW_SHOW) 
While 1 
    $nMsg = GUIGetMsg() 
    Switch $nMsg 
     Case $GUI_EVENT_CLOSE 
       GUIDelete(AxeLcGUI) 
       ExitLoop 

     Case $btnSave 
      Global $axeReal = GUICtrlRead($AxNum) 
      IniWrite("Userinfo.ini", "AxeLC", "Axe", $axeReal) 
      Global $lcReal = GUICtrlRead ($LcNum) 
      IniWrite("Userinfo.ini", "AxeLC", "LC", $lcReal) 

     Case $LootAssist 
      $axeReal = GUICtrlRead($AxNum) 
      $lcReal = GUICtrlRead($LcNum) 
      Call ("AxeLcFarm") 




    EndSwitch 
WEnd 
EndFunc 

Func AxeLCFarm() 
     With $ie 

       Local $oInputs = _IETagNameGetCollection($ie, "input") 
       For $oInput In $oInputs 
       If $oInput.name == "axe" Then 
        $oInput.value = $axeReal 
        EndIf 
       Next 
       Local $oInputs = _IETagNameGetCollection($ie, "input") 
       For $oInput In $oInputs 
       If $oInput.name == "light" Then 
        $oInput.value = $lcReal 
        EndIf 
       Next 
       EndWith 

EndFunc 

Func LootAssist() 
       With $ie 
       Local $oInputs = _IETagNameGetCollection($ie, "a") 
       For $oInput In $oInputs 
       If $oInput.title == "Loot Assistant" Then 
        $oInput.fireEvent("onmousedown") 
        sleep ($slpLow) 
        $oInput.fireEvent("onmouseup") 
        _IEAction($oInput, "click") 
        EndIf 
       Next 
       EndWith 
    EndFunc 

Func Farm() 
WinActivate ('001') 
send ('A') 
Sleep (100) 
send ('A') 
Sleep (100) 
send ('A') 
Sleep (100) 
send ('A') 
Sleep (100) 
send ('A') 
Sleep (100) 
send ('A') 
Sleep (100) 
send ('A') 
Sleep (100) 
send ('A') 
Sleep (100) 
send ('A') 
EndFunc 

Func Terminate() 
Exit 0 
EndFunc 

基本的には、入力をAxeLcGUIに入力すると、mainGUIに移動してコードを破棄します。

+0

固定されています。 GUIを使用する代わりに、inputboxを使用して情報を収集するだけではるかに簡単で効率的です。それで余分な頭痛をすべて処理する必要はありません。 – James

答えて

0

&hellip;ポップアップGUIに情報を入力すると、メインGUIも反応して&hellipします。 documentation 1として



$aArray[0] = 0またはイベントIDまたはコントロールID
$aArray[1] =

情報は、拡張情報を持つ配列に返されるパラメータ "高度" を使用イベントのウィンドウハンドル
$aArray[2] =イベントが発生したコントロールハンドル(該当する場合)
$aArray[3]
$aArray[4]

GUIGetMsg($GUI_EVENT_ARRAY)ウィンドウの識別を可能にする(GUIウインドウに対して)マウスカーソルの現在のY位置=(GUIウインドウに対して)マウスカーソルの現在のX位置=そこからメッセージが発信されます。例:

If $aArray[0] = $GUI_EVENT_CLOSE And $aArray[1] = $hGUI2 Then 

    ; Your code 

EndIf 
関連する問題