lenorcam Posted May 27, 2021 Share Posted May 27, 2021 (edited) expandcollapse popup#include <GUIConstantsEx.au3> GUICreate("AutoIT", 979, 297) GUICreate("AutoIT", 500, 663) GUISetState(@SW_SHOWMINIMIZED) HotKeySet("{F4}", "ExitProg1") ; ;;Sets F4 as a hotkey to exit the progam Global $g_iVariable = 0 While 1 If PixelGetcolor (500,663) = 3509706 Then If PixelGetColor (979,297) = 10709289 Then MouseClick("left",359,670) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(28900) EndIf If PixelGetColor(979,297) = 7891747 Then MouseClick("left",359,670) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(28900) EndIf If PixelGetColor(979,297) = 7891747 Then MouseClick("left",359,670) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(28900) EndIf If PixelGetColor(979,297) = 7891747 Then MouseClick("left",359,670) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(28900) EndIf If PixelGetColor(979,297) = 10709289 Then MouseClick("left",359,670) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(28900) EndIf If PixelGetColor(979,297) = 7891747 Then MouseClick("left",359,670) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(28900) EndIf If PixelGetColor(979,297) = 7891747 Then MouseClick("left",359,670) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(28900) EndIf If PixelGetColor(979,297) = 7891747 Then MouseClick("left",359,670) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(28900) EndIf If PixelGetColor(979,297) = 10709289 Then Func _SelfRestart() ; code for returning in top of my code EndFunc ;==>_SelfRestart EndIf ;---------------------------------------------------------------- If PixelGetColor(979,297) = 10709289 Then MouseClick("left",359,670) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(26900) EndIf If PixelGetColor(979,297) = 7891747 Then MouseClick("left",359,670) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(26900) EndIf If PixelGetColor(979,297) = 7891747 Then MouseClick("left",359,670) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(26900) EndIf If PixelGetColor(979,297) = 10709289 Then Func _SelfRestart() ; code for returning in top of my code EndFunc ;==>_SelfRestart EndIf If PixelGetColor(979,297) = 7891747 Then MouseClick("left",359,670) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(27900) EndIf If PixelGetColor(979,297) =10709289 Then MouseClick("left",479,671);5PESOS;16pesos Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",359,670) Sleep(300) MouseClick("left",941,541) Sleep(26900) EndIf If PixelGetColor(979,297) = 10709289 Then Func _SelfRestart() ; code for returning in top of my code EndFunc ;==>_SelfRestart EndIf If PixelGetColor(979,297) = 7891747 Then MouseClick("left",479,671) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",359,670) Sleep(300) MouseClick("left",369,526) Sleep(26900) EndIf If PixelGetColor(979,297) = 7891747 Then MouseClick("left",479,671) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",359,670) Sleep(300) MouseClick("left",941,541) Sleep(26900) EndIf If PixelGetColor(979,297) = 10709289 Then Func _SelfRestart() ; code for returning in top of my code EndFunc ;==>_SelfRestart EndIf If PixelGetColor(979,297) = 7891747 Then MouseClick("left",479,671) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",359,670) Sleep(300) MouseClick("left",369,526) Sleep(26900) EndIf ;--------------------------------------------------------- If PixelGetColor(979,297) = 10709289 Then MouseClick("left",596,670) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",359,670) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(25500) EndIf If PixelGetColor(979,297) = 7891747 Then MouseClick("left",596,670) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",359,670) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(25500) EndIf Func _SelfRestart() ; code for returning in top of my code EndFunc ;==>_SelfRestart EndIf If PixelGetColor(979,297) = 7891747 Then MouseClick("left",596,670) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",359,670) Sleep(300) MouseClick("left",941,541) Sleep(300) MouseClick("left",941,541) Sleep(25500) EndIf If PixelGetColor(979,297) = 7891747 Then MouseClick("left",596,670) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",359,670) Sleep(300) MouseClick("left",369,526) Sleep(300) MouseClick("left",369,526) Sleep(25500) EndIf EndIf WEnd Edited May 27, 2021 by Melba23 Added code tags Link to comment Share on other sites More sharing options...
lenorcam Posted May 27, 2021 Author Share Posted May 27, 2021 I need to return to top of the code when getpixel is true Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 27, 2021 Moderators Share Posted May 27, 2021 lenorcam, Welcome to the AutoIt forums. Using Pixel* and MouseClick functions is a pretty poor way of automating an app. Just what are you trying to do - we might be able to offer you a better solution, and perhaps get you a higher grade. 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...
lenorcam Posted May 27, 2021 Author Share Posted May 27, 2021 I just want to know what code for returning in the top of code this is for learning purpose only. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 27, 2021 Moderators Share Posted May 27, 2021 lenorcam, Quote this is for learning purpose only But of course. M23 Earthshine and lenorcam 1 1 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...
JockoDundee Posted May 27, 2021 Share Posted May 27, 2021 42 minutes ago, lenorcam said: I just want to know what code for returning in the top of code ContinueLoop Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
lenorcam Posted May 27, 2021 Author Share Posted May 27, 2021 1 hour ago, JockoDundee said: ContinueLoop How to do that? Can you please write a code Link to comment Share on other sites More sharing options...
Developers Jos Posted May 27, 2021 Developers Share Posted May 27, 2021 7 minutes ago, lenorcam said: Can you please write a code Did you open the helpfile and check out ALL the examples of the different loop option like For...Next, While...Wend etc? Jos Earthshine 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...
JockoDundee Posted May 27, 2021 Share Posted May 27, 2021 2 hours ago, lenorcam said: this is for learning purpose only. Is this for a typing class? Earthshine 1 Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
lenorcam Posted May 27, 2021 Author Share Posted May 27, 2021 1 hour ago, JockoDundee said: Is this for a typing class? Yes something like that Earthshine 1 Link to comment Share on other sites More sharing options...
lenorcam Posted May 27, 2021 Author Share Posted May 27, 2021 1 hour ago, Jos said: Did you open the helpfile and check out ALL the examples of the different loop option like For...Next, While...Wend etc? Jos Yes i try but like what i said I'm a student and new for coding Link to comment Share on other sites More sharing options...
Developers Solution Jos Posted May 27, 2021 Developers Solution Share Posted May 27, 2021 3 minutes ago, lenorcam said: Yes i try but like what i said I'm a student and new for coding That is no excuse so goes into the BS bucket! Try again and this time show something with some substance that clearly shows what you have tried and isn't working. On top of that you have to clearly tell us what it is your are trying to get done as "this is for learning purpose only" is already dumped into that same BS bucket! So try again and this time be absolutely clear. Earthshine and lenorcam 1 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...
Confuzzled Posted June 15, 2021 Share Posted June 15, 2021 1: For bonus marks, study loops and passing parameters to functions and returning values. Add comments for what the values are that you are testing for in your code to make it self documenting, pseudocode: If pixelcolorvalue = whatever, go call the function and pass values for mouseclick values. In your function do the mouseclicks using the passed values. You may not need to return any value in this example. It makes you code more flexible, far shorter, and easier to read and debug. 2: Using "AutoIT" as the name for your GUI is asking for confusion. Make it unique. Does the second one need to be there with exactly the same name? 3: I'm curious why you are testing the exact edges of your created GUI screen? 4: What is the purpose of this code? Link to comment Share on other sites More sharing options...
JockoDundee Posted June 15, 2021 Share Posted June 15, 2021 On 5/27/2021 at 4:57 AM, Jos said: That is no excuse so goes into the BS bucket! And now we have a marked solution that others can rely upon Code hard, but don’t hard code... 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