eKolin Posted June 5, 2016 Share Posted June 5, 2016 (edited) expandcollapse popup$value1=0 $value2=0 Global $hGUI = GUICreate("V1", 573, 120, -1, -1) GUICtrlCreateLabel("Value1", 16, 16, 188, 17) Global $iVariable = GUICtrlCreateInput("0", 208, 16, 105, 21) Global $Label2 = GUICtrlCreateLabel("OR", 320, 16, 116, 17) GUICtrlCreateLabel("Value2", 17, 85, 188, 50) Global $iVariable2 = GUICtrlCreateInput("0", 209, 82, 105, 21) Global $Label4 = GUICtrlCreateLabel("k", 318, 85, 105, 50) Global $bChange = GUICtrlCreateButton("Start", 440, 16, 113, 57) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case -3 Exit Case $bChange $value1 = GUICtrlRead($iVariable) $value2 = GUICtrlRead($iVariable2) WinClose("V1") EndSwitch Sleep(10) WEnd $x = WinActivate("Screen") While ($value1>245160) functions() $value1-=245160 WEnd While ($value2>0) functions() $value2-=1 WEnd I was expecting, that after i will press the "start" button the window will close and perform functions(). What's wrong with this? (After i've typed "2" in $value2 field) Edited June 5, 2016 by eKolin Typo Link to comment Share on other sites More sharing options...
water Posted June 5, 2016 Share Posted June 5, 2016 Why should it call functions()? You never leave the While 1 loop. BTW: Why do you want to WinClose the GUI you created yourself. Do you want to minimize the window or what do you try to achieve? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Developers Jos Posted June 5, 2016 Developers Share Posted June 5, 2016 WinClose() is not the right function to use here but rather use GuiDelete() Jos eKolin 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
eKolin Posted June 5, 2016 Author Share Posted June 5, 2016 (edited) @waterI'm trying to change 2 $variables values and then when pressed "start" the GUI would dissapear and following functions would be executed depending on values I've found that While ($variable>0) Wend Works good when i want to do exact amount of loops, unless you've a better suggestion. Btw i've replaced like 200 lines of unneeded code to functions() Edited June 5, 2016 by eKolin Typo Link to comment Share on other sites More sharing options...
Trong Posted June 5, 2016 Share Posted June 5, 2016 (edited) Try: expandcollapse popupOpt("TrayAutoPause", 0) Global $hGUI = GUICreate("V1", 573, 120, -1, -1) GUICtrlCreateLabel("Value1", 16, 16, 188, 17) Global $iVariable = GUICtrlCreateInput("0", 208, 16, 105, 21) Global $Label2 = GUICtrlCreateLabel("OR", 320, 16, 116, 17) GUICtrlCreateLabel("Value2", 17, 85, 188, 50) Global $iVariable2 = GUICtrlCreateInput("0", 209, 82, 105, 21) Global $Label4 = GUICtrlCreateLabel("k", 318, 85, 105, 50) Global $bChange = GUICtrlCreateButton("Start", 440, 16, 113, 57) GUISetState(@SW_SHOW) Global $value1 = 0 Global $value2 = 0 Global $gold, $trips While 1 Switch GUIGetMsg() Case -3 Exits() Case $bChange $value1 = GUICtrlRead($iVariable) $value2 = GUICtrlRead($iVariable2) GUISetState(@SW_HIDE, $hGUI) TrayTip("Auto Start", "Working...", 1) WinActivate("Screen") While ($value1 > 245160) FunctionAutoGame() $gold -= 245160 WEnd While ($value2 > 0) FunctionAutoGame() $trips -= 1 WEnd GUISetState(@SW_SHOW, $hGUI) GUISetState(@SW_RESTORE, $hGUI) EndSwitch WEnd Func FunctionAutoGame() ; Start auto game EndFunc ;==>FunctionAutoGame Func Exits() Exit EndFunc ;==>Exits OR: expandcollapse popupOpt("TrayAutoPause", 0) Global $hGUI = GUICreate("V1", 573, 120, -1, -1) GUICtrlCreateLabel("Value1", 16, 16, 188, 17) Global $iVariable = GUICtrlCreateInput("0", 208, 16, 105, 21) Global $Label2 = GUICtrlCreateLabel("OR", 320, 16, 116, 17) GUICtrlCreateLabel("Value2", 17, 85, 188, 50) Global $iVariable2 = GUICtrlCreateInput("0", 209, 82, 105, 21) Global $Label4 = GUICtrlCreateLabel("k", 318, 85, 105, 50) Global $bChange = GUICtrlCreateButton("Start", 440, 16, 113, 57) GUISetState(@SW_SHOW) Global $value1 = 0 Global $value2 = 0 Global $gold, $trips While 1 Switch GUIGetMsg() Case -3 Exits() Case $bChange $value1 = GUICtrlRead($iVariable) $value2 = GUICtrlRead($iVariable2) GUIDelete($hGUI) While ($value1 > 245160) FunctionAutoGame() $gold -= 245160 WEnd While ($value2 > 0) FunctionAutoGame() $trips -= 1 WEnd EndSwitch WEnd Func FunctionAutoGame() ; Start auto game EndFunc ;==>FunctionAutoGame Func Exits() Exit EndFunc ;==>Exits R expandcollapse popupOpt("TrayAutoPause", 0) Global $hGUI = GUICreate("V1", 573, 120, -1, -1) GUICtrlCreateLabel("Value1", 16, 16, 188, 17) Global $iVariable = GUICtrlCreateInput("0", 208, 16, 105, 21) Global $Label2 = GUICtrlCreateLabel("OR", 320, 16, 116, 17) GUICtrlCreateLabel("Value2", 17, 85, 188, 50) Global $iVariable2 = GUICtrlCreateInput("0", 209, 82, 105, 21) Global $Label4 = GUICtrlCreateLabel("k", 318, 85, 105, 50) Global $bChange = GUICtrlCreateButton("Start", 440, 16, 113, 57) GUISetState(@SW_SHOW) Global $value1 = 0 Global $value2 = 0 Global $gold, $trips While 1 Switch GUIGetMsg() Case -3 Exits() Case $bChange $value1 = GUICtrlRead($iVariable) $value2 = GUICtrlRead($iVariable2) GUIDelete($hGUI) ExitLoop EndSwitch WEnd WinActivate("Screen") While ($value1 > 245160) FunctionAutoGame() $gold -= 245160 WEnd While ($value2 > 0) FunctionAutoGame() $trips -= 1 WEnd Func FunctionAutoGame() ; Start auto game EndFunc ;==>FunctionAutoGame Func Exits() Exit EndFunc ;==>Exits Edited June 5, 2016 by Trong ; Regards, Link to comment Share on other sites More sharing options...
water Posted June 5, 2016 Share Posted June 5, 2016 With "disappear" you mean "become invisible" (so it can be displayed again after the functions have ended) or "delete"? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
eKolin Posted June 5, 2016 Author Share Posted June 5, 2016 (edited) @waterDelete. I will try Trong suggestion in a minute. Jeez i've messed up in original code. Tried to be sneaky but didin't change $gold and $trips. Don't be rude at me for game automation, it's just that i want to have a goal where i could say that i'm good enough in AutoIt to go advanced. Btw i've edited main post "While" and "Wend" stuff. EDIT:@Trong Modified your first script and got what i've wanted Edited June 5, 2016 by eKolin Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 5, 2016 Moderators Share Posted June 5, 2016 Kolin, 59 minutes ago, eKolin said: Tried to be sneaky but didin't change $gold and $trips. Don't be rude at me for game automation That is your flex all used up, so do not try that again. 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now