Guest dhoo3 Posted January 2, 2005 Share Posted January 2, 2005 Need code to move the mouse cursor to a specified pixel color on a web page. Have made a simple script from Au3's help file but it will only move to a specified X,Y coordinate. I have the specified color. Preferably it would go from that color instance to the next (same)color instance on the page. perhaps a looping idea? Any help would be beneficial, thank's. Link to comment Share on other sites More sharing options...
layer Posted January 2, 2005 Share Posted January 2, 2005 sure, While 1 $pix= PixelSearch ( left, top, right, bottom, color [, shade-variation] [, step]] ) Select Case $pix= SOME COLOR MouseMove ($pix[0], $pix[1]) EndSelect Wend untested, sorry... or you could use If statements instead of Select... FootbaG Link to comment Share on other sites More sharing options...
CyberSlug Posted January 2, 2005 Share Posted January 2, 2005 Something like this might help get you started; otherwise, you might need to put PixelGetColor in a while loop.... While 1 $coord = PixelSearch($left, $top, $right, $bottom, $color) If Not @error Then MouseMove($coord[0], $coord[1], 0) WEnd Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
Guest dhoo3 Posted January 3, 2005 Share Posted January 3, 2005 (edited) I'm getting Variable not declared error in this script. Line 7 Case $pix= 0x808080 Of course, i'd better mention i'm using win98. =================================== Opt("MouseCoordMode",0) Opt("PixelCoordMode",0) WinWait("America Online","") If Not WinActive("America Online","") Then WinActivate("America Online","") WinWaitActive("America Online","") Select Case $pix= 0x808080 While 1 $coord = PixelSearch($left, $top, $right, $bottom, $color) If Not @error Then MouseMove($coord[0], $coord[1], 0) MouseMove ($pix[0], $pix[1]) Wend MouseClick("right", ($pix[0], $pix[1]) ) Sleep(100) Send("h") EndSelect Edited January 3, 2005 by dhoo3 Link to comment Share on other sites More sharing options...
the_lord_mephy Posted January 3, 2005 Share Posted January 3, 2005 If that's your whole script, it's right. $pix isn't declared. You don't have like $pix = PixelSearch() anywhere. My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote] Link to comment Share on other sites More sharing options...
phillip123adams Posted January 3, 2005 Share Posted January 3, 2005 I'm getting Variable not declared error in this script.Line 7Case $pix= 0x808080 ===================================<{POST_SNAPBACK}>Hi dhoo3,Your code actually produces 14 errors because you simply copied the example code provided by the earlier posts. They attempted only to guide you in the right direction, and intended that you should look up the functions in the help file and make the appropriate substitutions.May I suggest downloading the free SciTe editor which you can find by searching this forum. It's a very nice editor with alot of support for AutoIt. It found your errors instantly, and indicated the nature of the problem.I think the following is what you are looking for. Be advised that much more may be required to achieve your overall objectives.;; The desired color (put the color you want here) $iColor = 0x808080 ;; Search the entire screen for the specified color. This returns only the ;; first pixel location in the search pattern that matches the specified ;; color, and can take a 10 or 15 seconds depending on how far it is from ;; 0,0 (top left). It would be better if you can reduce the search area. $aPix = PixelSearch (0, 0, @DesktopWidth, @DesktopHeight, $iColor) ;; Move the mouse to the location of the color (10 = set to slowest movement) ;; This is not needed if you are going to click at that location. ; MouseMove ($aPix[0], $aPix[1], 10) ; Right click at the found location. MouseClick("right", $aPix[0], $aPix[1]) Exit Phillip Link to comment Share on other sites More sharing options...
Guest dhoo3 Posted January 3, 2005 Share Posted January 3, 2005 Hi dhoo3,Your code actually produces 14 errors because you simply copied the example code provided by the earlier posts. They attempted only to guide you in the right direction, and intended that you should look up the functions in the help file and make the appropriate substitutions.May I suggest downloading the free SciTe editor which you can find by searching this forum. It's a very nice editor with alot of support for AutoIt. It found your errors instantly, and indicated the nature of the problem.I think the following is what you are looking for. Be advised that much more may be required to achieve your overall objectives.;; The desired color (put the color you want here) $iColor = 0x808080 ;; Search the entire screen for the specified color. This returns only the ;; first pixel location in the search pattern that matches the specified ;; color, and can take a 10 or 15 seconds depending on how far it is from ;; 0,0 (top left). It would be better if you can reduce the search area. $aPix = PixelSearch (0, 0, @DesktopWidth, @DesktopHeight, $iColor) ;; Move the mouse to the location of the color (10 = set to slowest movement) ;; This is not needed if you are going to click at that location. ; MouseMove ($aPix[0], $aPix[1], 10) ; Right click at the found location. MouseClick("right", $aPix[0], $aPix[1]) Exit<{POST_SNAPBACK}>========================You're right about just copying, he said embarrassed, but , i have a defense in that i have been a staunch advocate of Autoit ..........[so much so that i stayed with Windows all this time but would've left windows in a heartbeat for another OS except that John wrote in and said he couldn't write for Lindows(called Linspire now because he didn't find a send code that would work with linux systems)]........particularly Autoit 2 for a few years and have written tons of Au2 scripts BUT Au3 is mucho more accurate BUT )for some reason (age,i guess) Au3 syntax is still a hard one for me to wrap my mind around.I keep forgetting this and that whereas when i first downloaded Au2 i studied that help manual inside and out and can write most all scripts without even a help file.6 months ago i lost ALL my data on my hard drive(don't ask) and had to re-write many scripts over agin (fortunately i had saved many early script folders on another media sooooooo it wasn't a total loss and Au3 stuff just faded into the background , so to speak, and ,i know, postively that Au3 is totally awesome in its accuracy, umpteen times better than au2.So many thanks for your understanding post and i will DL the editor mentioned above.This looks like it will work. ] 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