Zithen Posted April 20, 2005 Posted April 20, 2005 starting to like this program a lot trying to do something more advanced to me but messing up somewhere. all this is doing is clicking the mouse then checking to see if the background has white (mine is pure blue) then if it detect white to end the current loop of clicking and contunie on the the main loop. i dont know what i am missing but missing something. just a quick code snip (msgbox prob not work just wote that in so not to past a mile long code that does about nothing heh) expandcollapse popupwhile 1 MsgBox(0, "start") begin() while 1 findpix() click1() findpix() click2() findpix() wend stop() MsgBox(0, "end") wend func begin() mousemove(400,700) mouseclick("left") sleep(200) endfunc func click1() mousemove(300,300) mouseclick("left") sleep(200) endfunc func click2() mousemove(400,700) mouseclick("left") sleep(200) endfunc func stop() mousemove(400,300) mouseclick("left") sleep(200) endfunc func findpix() $coord = PixelSearch( 0, 0, 500, 500, 0xFFFFFF ) If Not @error Then stop() EndIf endfunc
buzz44 Posted April 21, 2005 Posted April 21, 2005 Why not just use PixelGetColor().$X =;Some place on your desktop $Y =;Some place on your desktop If = PixelGetColor($X , $Y) = 16777215 Then ;Do stuff here EndIf qq
herewasplato Posted April 21, 2005 Posted April 21, 2005 (edited) ... then if it detect white to end the current loop of clicking and ...I'm not positive, but I think that you never exit the "current loop of clicking":do findpix - if white not found, returns to the center loop to run "Click1"ordo findpix - if white found:runs stop which returns to findpix,which returns to the center loop to run "Click1"I'm not sure if I was able to spell it out in English.If you want to "watch" the script work, then add a message box or two.This is a slightly different and slower version of your code to help me "see" it.HotKeySet("{PAUSE}", "Terminate") While 1 MsgBox(0, "", "start") MouseClick("left", 400, 700, 1, 100) While 1; current loop of clicking findpix() MouseClick("left", 300, 300, 1, 100) findpix() MouseClick("left", 400, 700, 1, 100) findpix() WEnd MouseClick("left", 400, 300, 1, 100) MsgBox(0, "", "end") WEnd Exit Func stop() MouseMove(400, 300) MouseClick("left") Sleep(200) MsgBox(0, "", "stop") EndFunc ;==>stop Func findpix() $coord = PixelSearch(0, 0, 500, 500, 0xFFFFFF) MsgBox(0, "", "pix result " & @error) If Not @error Then stop() EndIf EndFunc ;==>findpix Func Terminate() Exit EndFunc ;==>TerminateIf you run the code shown below first and then start the code above (have them both running at the same time) you can "see" more. [yes, I know... two scripts with same hotkey... I don't care for this test.] You can also change the windows in your pixel seach area while the script is sitting at a message box and "see" the results.;0 = Use Mouse Coordinates relative to window ;1 = Use Mouse Coordinates relative to desktop AutoItSetOption ("MouseCoordMode", 1) HotKeySet ("{PAUSE}", "Terminate") While 1 $pos=MouseGetPos() ToolTip("X: " & $pos[0] & ", " & "Y: " & $pos[1] & " Pause2exit") Sleep (1) WEnd EXIT Func Terminate() ClipPut('MouseClick("left",' & $pos[0] & ',' & $pos[1] & ',1,1)') EXIT EndFuncI've not solved the problem for you. I've not changed your code to make it do what you described. Suggest you look into using "exitloop" within the middle loop.later........EDIT: changed second script to "Use Mouse Coordinates relative to desktop"EDIT2: not to insult, stating the obvious - use "enter" to get rid of each message box so that you do not have to move the mouse to click on them - since the mouse position is part of what you are "watching".............. Edited April 21, 2005 by herewasplato [size="1"][font="Arial"].[u].[/u][/font][/size]
Zithen Posted April 21, 2005 Author Posted April 21, 2005 I've not solved the problem for you. I've not changed your code to make it do what you described. Suggest you look into using "exitloop" within the middle loop.its a great push in the right direction. thanks for all the help, i'm sure that with this information i should be able to complete it. Now just to make a script that is usefull lol
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