michu Posted September 29, 2015 Share Posted September 29, 2015 (edited) Hello everyoneI have problem with my simple script. When at position (1743,511) on second page is red color I wan't to left click next button to third page and back to first page by pressing 2 times Escape, otherwise it should back to the first page and try over and over again as soon as there will be red color on second page. For now script doesn't work, I don't know why. It's looks like function PixelGetColor doesn't work.Thanks in advance for helpHotKeySet("{Space}", "Terminate") While 1 MouseClick("left", 1826 ,1013, 1, 100) ;it's next button on first page $var = PixelGetColor (1743,511) If $var = 0xFF0000 Then MouseClick("left", 1743, 511, 1, 100) ;it's next button on second page Send("{ESC 1}") Sleep(500) Send("{ESC 1}") Sleep(500) Else Send("{ESC 1}") ;back to the first page Sleep(1500) EndIf Sleep(500) WEnd Func Terminate() Exit 0 EndFunc Edited September 29, 2015 by michu Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 29, 2015 Moderators Share Posted September 29, 2015 (edited) michu,Welcome to the AutoIt forums.It's looks like function PixelGetColor doesn't work I am sure it is more likely to be your code. That code snippet will act extremely quickly - are you sure that the "page" will have changed by the time you look for the "red" section and then click on one of the buttons? If the page has not yet correctly loaded then obviously none of the actions will happen on the "page" you think you are using.So how can you tell if the page has indeed changed? What allows you to confirm that the "red" section might be present and that he buttons are ready to be pressed? Once you can confirm that the "page" is correctly loaded, then you can start looking and actioning it.M23 Edited September 29, 2015 by Melba23 Typo michu 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...
michu Posted September 29, 2015 Author Share Posted September 29, 2015 (edited) When I increase times to seconds and the second page load with not red color long time before cursor is in position (1743,511) the script press next button. Maybe I should declare 2 colours? The second page is only in two colours - red and white. Red> go to next page and then press 2 times escape buttonWhite> back to first page by pressing one time escape button and try again Edited September 29, 2015 by michu Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 29, 2015 Moderators Share Posted September 29, 2015 michu,Without sight of the "pages" it is hard to say whether your idea is a good one. But it seems that as I suspected timing was the major problem in your earlier script - I am sure you can come up with a solution now.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...
michu Posted September 29, 2015 Author Share Posted September 29, 2015 Thank you, I will try with WaitPixelColorfunction Link to comment Share on other sites More sharing options...
computergroove Posted September 29, 2015 Share Posted September 29, 2015 There is no waitpixelcolor. You need to add some lines of sleep in there to allow the page to change.While 1 MouseClick("",1826,1013,1,100);100 is pretty slow for the mouse move. Sleep(3000);sleep for 3 seconds to let the page load $var - PixelGetColor(1743,511) If $Var == 0xFF0000 Then MouseClick("",1743,511,1,100) Sleep(250) Send("{ESC}") Sleep(250) Send("{ESC}") Else Send("{ESC}") Sleep(1.5 * 1000);sleep for 1.5 seconds EndIf Sleep(500) WEnd Func Terminate() Exit 0 EndFunc Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html 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