schiznak Posted June 29, 2007 Share Posted June 29, 2007 Ok, basically i've never scripted before so bear with me. I'm trying to make a script that will : Click on a spotpress down 2x, then press enterscan a rectangle for the color #702068Right Click on any instances of the color #702068press escRepeatUnfortunately, i'm stuck on Right Click on any instances of the color #702068. I have no idea how i am meant to get the information from the previous line to right click on the color #702068So i was wondering if anyone can tell me how to do it/point me at somewhere that willAlso, how do i make a script loop?Here's what the script looks like so farMouseClick ( "primary" [, 593, 253]SEND {DOWN}Send {DOWN}SeNd {Enter}PixelSearch (519, 139, 580, 423, #702068) Dunno what goes hereSend {esc}Loop (dont know how) Link to comment Share on other sites More sharing options...
Generator Posted June 29, 2007 Share Posted June 29, 2007 (edited) Ok, basically i've never scripted before so bear with me. I'm trying to make a script that will : Click on a spot press down 2x, then press enter scan a rectangle for the color #702068 Right Click on any instances of the color #702068 press esc Repeat Unfortunately, i'm stuck on Right Click on any instances of the color #702068. I have no idea how i am meant to get the information from the previous line to right click on the color #702068 So i was wondering if anyone can tell me how to do it/point me at somewhere that will Also, how do i make a script loop? Here's what the script looks like so far MouseClick ( "primary" [, 593, 253] SEND {DOWN} Send {DOWN} SeNd {Enter} PixelSearch (519, 139, 580, 423, #702068) Dunno what goes here Send {esc} Loop (dont know how)Wrapped it up a bit for you... HotKeySet("{PRINTSCREEN}","_Exit") HotKeySet("{PAUSE}","_Start") Global $Bool=False While 1 Sleep(10) WEnd Func _Exit() Exit EndFunc Func _Start() $Bool=Not $Bool While $Bool=True MouseClick("left",593,293) Send("{2 DOWN}") Send("{ENTER}") Do $Coord=PixelSearch(519, 139, 580, 423, #702068) MouseClick("Right",$Coord[0],$Coord[1]) Until @Error=1 Send("{ESC}") WEnd EndFunc This should work out, not tested btw. Edit: Missed 1 keysend Edited June 29, 2007 by Generator Link to comment Share on other sites More sharing options...
demodemo Posted June 29, 2007 Share Posted June 29, 2007 that was some quick help.. i hope i get the same feed on my inquiry Link to comment Share on other sites More sharing options...
schiznak Posted June 29, 2007 Author Share Posted June 29, 2007 First of all, thx for all the help in writing that. Second, im getting an error, i don't know if it's the script or it's just the way im using it, but whenever i go to start the script, i get this MouseClick("Right",$Coord[0],$Coord[1]) MouseClick("Right",$Coord^ ERROR Error: Subscript used with non-Array variable Link to comment Share on other sites More sharing options...
Uten Posted June 29, 2007 Share Posted June 29, 2007 The color searched for is not found. $Coord=PixelSearch(519, 139, 580, 423, #702068)oÝ÷ Ù6¤y©h¢F>,^'ÈbØ^éi~)^Eæiº.¶Ø^zºè®·º¹Þu8^ë²)à)¶¬¶+j©iê뢸ZÙ^«¢+ØÀÌØí ½½ÉõA¥á±MÉ ÔÄä°ÄÌä°ÔàÀ°ÐÈÌ°ÜÀÈÀØà¤)%9½ÑÉÉ½È ¤Q¡¸(5½ÕÍ ±¥¬ ÅÕ½ÐíI¥¡ÐÅÕ½Ðì°ÀÌØí ½½ÉlÁt°ÀÌØí ½½ÉlÅt¤)±Í(á¥Ñ1½½À)¹%)Õ¹9½ÑÉÉ½È ÀÌØí±¥¹õMÉ¥ÁÑ1¥¹9յȰÀÌØíÉÈõÉɽȰÀÌØíáÐõáѹ¤(%ÀÌØíÉȱÐìÐìÀÑ¡¸(5ͽà ÄØ°ÅÕ½ÐíII=H°ÅÕ½Ðíб¥¹èÅÕ½ÐìµÀìÀÌØí±¥¹µÀì I1µÀìÅÕ½ÐíÉɽÈèÅÕ½ÐìµÀìÀÌØíÉȵÀì I1µÀìÅÕ½ÐíáѹèÅÕ½ÐìµÀìÀÌØíáеÀì I1µÀìÅÕ½Ðí=ÕÉÅÕ½Ðì¤(¹%(IÑÕɸ ÀÌØíÉɽÈôÀ¤)¹Õ¹ PS: from the top of my head so it is not tested Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
mikehunt114 Posted June 29, 2007 Share Posted June 29, 2007 (edited) I noticed a few errors in Generator's code (Send("{2 DOWN}") actually holds the '2' key down until given an up command, and the PixelSearch loop was not checking for success before trying to use the coordinates, which would result in an error if the color wasn't found). I think this will do what you're needing, but not necessarily. Hopefully you can figure out the tweaking if necessary. HotKeySet("{ESC}","Terminate") $color = 702068 $left = 519 $top = 139 $right = 580 $bottom = 423 While 1 MouseClick("left", 593, 253) Send("{DOWN 2}") Send("{ENTER}") $search = PixelSearch($left, $top, $right, $bottom, $color) If IsArray($search) Then MouseClick("right", $search[0], $search[1]) Send("{ESC}") WEnd Func Terminate() ExitLoop EndFunc Note that this will send ESC whether it finds the color or not, I don't know if that is desired. Also, it will stop searching for the color once it finds it, right-click it twice, send esc, and THEN start the color search again. I'm wondering if you need it to find all the instances of that color first, click all of them, then hit ESC? Also, it will loop indefinitely until you hit ESC. Hopefully you can figure the rest out, cheers. Edited June 29, 2007 by mikehunt114 IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font] 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