Qsert18 Posted May 13, 2011 Share Posted May 13, 2011 (edited) hey guys,i've got another question:I've written a code which is fully working now.But there is 1 problem left, i'll explain the situation and my problem in the hope u can solve it.So, i've written a code which is doing some stuff for me.@the end of the code i've written ;--------------------------------------------------------------------win-------------------------------------------------------------$WaitPixelColor1=0xFFF46ADo $waitpixel1=PixelSearch (515, 241, 890, 322, $WaitPixelColor1,2) Until Not @error MouseClick("left",695,560,2)sleep (5000);--------------------------------------------------------------------lose-------------------------------------------------------------$WaitPixelColor2=0xAA0303Do $waitpixel2=PixelSearch (515, 241, 890, 322, $WaitPixelColor2,2) Until Not @error MouseClick("left",695,560,2)sleep (5000)So whenever a box pops up with those colors, than it should just click this point (695,560) and than STOP the code.Now my problem is: the script is running, the box pops up, the scrips keeps on running till it is finished and than the last part of the script (which i posted) will eventually click on the location i wantBut this way i lose lots of time, so i would just like to change it.It should become like this:The script is running, the box pops up, it clicks on the location, and the script stops running (no mather where it will end @the box pop up)I've searched some forums, and only found ProcessSetPriority ( "process", priority), but this is to give priority to a programm and not to a part of a script....Can someone please help me out?I really can't find a solution.Kind regard,stefan Edited May 13, 2011 by Qsert18 Link to comment Share on other sites More sharing options...
MrMitchell Posted May 13, 2011 Share Posted May 13, 2011 (edited) ;--------------------------------------------------------------------win-------------------------------------------------------------;--------------------------------------------------------------------lose-------------------------------------------------------------Win what? Lose what? Edited May 13, 2011 by MrMitchell Link to comment Share on other sites More sharing options...
Qsert18 Posted May 13, 2011 Author Share Posted May 13, 2011 ah win just means if it turns green, red if the box turns red... I'm trying it out with paint right now but can't get it to work Could u answer my question now? xd Link to comment Share on other sites More sharing options...
MrMitchell Posted May 13, 2011 Share Posted May 13, 2011 So it's wait until found win color, then click. Sleep 5 seconds. Then wait until found lose color, then click. Sleep 5 seconds. What do you want? Link to comment Share on other sites More sharing options...
Qsert18 Posted May 13, 2011 Author Share Posted May 13, 2011 no...Look I've got a script which is doing things like:mouseclick (...)sleep (50)mouseclick (...)(1)sleep (50)mouseclick (...)sleep (50)mouseclick (...)sleep (50)mouseclick (...)sleep (50);--------------------------------------------------------------------win------------------------------------------------------------- $WaitPixelColor1=0xFFF46A Do $waitpixel1=PixelSearch (515, 241, 890, 322, $WaitPixelColor1,2) Until Not @error MouseClick("left",695,560,2) sleep (5000) ;--------------------------------------------------------------------lose------------------------------------------------------------- $WaitPixelColor2=0xAA0303 Do $waitpixel2=PixelSearch (515, 241, 890, 322, $WaitPixelColor2,2) Until Not @error MouseClick("left",695,560,2)But during that script a box MIGHT pop up (time = unknown), if it's green/red it has to click a certain button.If it turns up at the end of all the mouseclicks, than the program will probly function: and the mouse will click the certain buttonBUT if the box pops up @ (1): than it will just continue the rest of the mouseclicks, untill it's finished and than just click the certain button.Now my question is: how can i set a priorityLike: the scripts (mouseclicks) is running BUT if the box pops up it jumps to the pixelsearch stuff....? Link to comment Share on other sites More sharing options...
MrMitchell Posted May 13, 2011 Share Posted May 13, 2011 Like: the scripts (mouseclicks) is running BUT if the box pops up it jumps to the pixelsearch stuff....?Ok so what do you use to determine when the box pops up? Don't you use pixelsearch to figure that out? Link to comment Share on other sites More sharing options...
Qsert18 Posted May 13, 2011 Author Share Posted May 13, 2011 (edited) $WaitPixelColor1=0xFFF46A Do $waitpixel1=PixelSearch (515, 241, 890, 322, $WaitPixelColor1,2) Until Not @error MouseClick("left",695,560,2I guess this means:If the color @ in a certain area changes into green, than it will click @ (695,560)So it's quite a pixelsearch right?But do u mean that i should do a pixelsearch after every mousclick(...) code?that's possible i think, but it would take lots of work, and i might try it out tomorrow, but i guess there is another solution. Edited May 13, 2011 by Qsert18 Link to comment Share on other sites More sharing options...
MrMitchell Posted May 13, 2011 Share Posted May 13, 2011 Let's see the entire script, I have Paint installed so it should work, right? Link to comment Share on other sites More sharing options...
Qsert18 Posted May 13, 2011 Author Share Posted May 13, 2011 sweat dreams, this boy is going to bed now hope to read the solution tomorrow Link to comment Share on other sites More sharing options...
Qsert18 Posted May 14, 2011 Author Share Posted May 14, 2011 So again: A script is running in cronologic order, from top to bottom let's say this is my script: (- = represent words,codes) --------(1) --------(2) --------(3) --------(4) --------(5) It should run from 1 to 4, but If the color pops up it should immedialy jump to (5) and not just continue running 1,2,3,4...untill 5. So the code (5) should actuelly have priority on the other 4 lines Link to comment Share on other sites More sharing options...
Qsert18 Posted May 14, 2011 Author Share Posted May 14, 2011 oké nvm.... i've putted a pixeldetection after everycode :s It's working though 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