Medallyon Posted August 23, 2015 Posted August 23, 2015 Dear AutoIt Community,I need some clarification as to why GUI does not work as planned. This is the snippet of code that's troubling me:Else GUICreate("Path", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, $WS_EX_ACCEPTFILES) Local $idFile = GUICtrlCreateInput("", 10, 5, 300, 20) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Local $idPath = GUICtrlRead($idFile) GUICtrlCreateLabel("Type path of .exe or drag file into InputBox", 10, 35) Local $idBtn = GUICtrlCreateButton("OK", 160 - 30, 75, 60, 20) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idBtn ExitLoop EndSwitch WEnd Run($idPath) ProcessWait("Patcher.exe") WinWait("Patcher") WinWaitActive("Patcher") If Not WinActive("Patcher") Then WinActivate("atcher") EndIf EndIfMy problem here is that when I want to exit the created GUI or press the button $idBtn, it won't exit. However, when I execute the following snippet by itself, it works.GUICreate("Path", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, $WS_EX_ACCEPTFILES) Local $idFile = GUICtrlCreateInput("", 10, 5, 300, 20) GUICtrlSetState(-1, $GUI_DROPACCEPTED) Local $idPath = GUICtrlRead($idFile) GUICtrlCreateLabel("Type path of .exe or drag file into InputBox", 10, 35) Local $idBtn = GUICtrlCreateButton("OK", 160 - 30, 75, 60, 20) GUISetState(@SW_SHOW) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idBtn ExitLoop EndSwitch WEndI don't know what to do.Mny Thanks in advance,~Medallyon
Moderators Melba23 Posted August 23, 2015 Moderators Posted August 23, 2015 Medallyon,The script is almost certainly halting at either the ProcessActive or WinWaitActive lines - add a timeout to them both so that the script proceeds with the loop until the process and GUI are present.M23P.S. And seeing the name of the process/GUI, could I point you to the Forum rules if you have not already read them. Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Medallyon Posted August 23, 2015 Author Posted August 23, 2015 (edited) @Melba23Thanks for your quick response.Medallyon,The script is almost certainly halting at either the ProcessActive or WinWaitActive lines - add a timeout to them both so that the script proceeds with the loop until the process and GUI are present.I added a timeout to both of the lines but that did nothing.P.S. And seeing the name of the process/GUI, could I point you to the Forum rules if you have not already read them.Ayy, I know the rules. My script in no way or form messes with games or game integrity (as far as I know). It's a mere process of clicking Login so that I don't have to do it.Why?Because I have too much time on my handsI take joy in creating thingsThis is the full code:<snip>If you have any more ideas I could try out, I welcome you to share them Many thanks in advance,~Medallyon Edited August 23, 2015 by Melba23 Code removed
Moderators Melba23 Posted August 23, 2015 Moderators Posted August 23, 2015 Medallyon,Ayy, I know the rules.Really? So how do you square this line:Run("lol.launcher.exe")with this prohibition?Do not ask for help with AutoIt scripts, post links to, or start discussion topics on the following subjects: [...] •Launching, automation or script interaction with games or game servers, regardless of the game.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Moderators Melba23 Posted August 23, 2015 Moderators Posted August 23, 2015 Medallyon,Correct - thread closed.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts