dre111 Posted December 15, 2005 Share Posted December 15, 2005 hey im trying to make a script that sends numpad3 every like half a second, while searching for a yellow color, and when it gets this yellow color in the certain area, itll stop. i can make it send the numpad3 and stuff, but im a little sketchy with the do until and pixelsearch functions, any1 wanna help a newb out? Link to comment Share on other sites More sharing options...
seandisanti Posted December 15, 2005 Share Posted December 15, 2005 hey im trying to make a script that sends numpad3 every like half a second, while searching for a yellow color, and when it gets this yellow color in the certain area, itll stop. i can make it send the numpad3 and stuff, but im a little sketchy with the do until and pixelsearch functions, any1 wanna help a newb out?always glad to help. welcome to the forums. what do you have already? Link to comment Share on other sites More sharing options...
dre111 Posted December 15, 2005 Author Share Posted December 15, 2005 (edited) i have really little done, and im completely stumped cause this is my first/second time doing something like this. (i know im a really big newb ) HotKeySet("{ESC}", "Terminate") ;;;;; Do Sleep("500") Send("{NUMPAD3}") Until ***CONFUSED HERE*** ;;;;;;;; Func Terminate() Exit 0 EndFunc i need to know what to use, i need it to keep hitting numpad3 and then when it detects this yellow color, then itll stop, and i can make it send the numpad3, but im so confused with the do until and if i am even supposed to use this, sorry for being so bad. lol Edited December 15, 2005 by dre111 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 15, 2005 Moderators Share Posted December 15, 2005 (edited) HotKeySet("{ESC}", "Terminate") Dim $Topx = 0 Dim $Topy = 0 Dim $Bottomx = 300 Dim $Bottomy = 200 Dim $Color = 0xFFFF00 ;;;;; Do $Pix = PixelSearch($Topx, $Topy, $Bottomx, $Bottomy, $Color) Sleep("500") Send("{NUMPAD3}") Until $Pix <> 1 ;;;;;;;; Func Terminate() Exit 0 EndFunc Edit: ['/code] would have been nice for me!! Edited December 15, 2005 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
dre111 Posted December 15, 2005 Author Share Posted December 15, 2005 thanks alot, im going to try it, if any1 else has suggestions or has a good place for tutorials, please let me know Link to comment Share on other sites More sharing options...
=sinister= Posted December 15, 2005 Share Posted December 15, 2005 (edited) How about this- $send = 1 Local $Pix1 = PixelSearch(0, 0, @DesktopWidth - 1, @DesktopHeight - 1, 0xE0ECE8, 10) While 1 if $send = 1 Send("{Num1}") Sleep(500) endif If $Pix1 <> 1 Then If IsArray($Pix1) Then $send = 0 Else endif Wend It's slopy, but hopefully helpful. Edited December 15, 2005 by =sinister= Link to comment Share on other sites More sharing options...
dre111 Posted December 15, 2005 Author Share Posted December 15, 2005 (edited) i entered it correctly, it runs with no errors, but its not detecting the color when it passes by, heres my code HotKeySet("{ESC}", "Terminate") Dim $Topx = 440 Dim $Topy = 297 Dim $Bottomx = 496 Dim $Bottomy = 317 Dim $Color = 0xDAB966 ;;;;; Do $Pix = PixelSearch($Topx, $Topy, $Bottomx, $Bottomy, $Color) Sleep("500") Send("{NUMPAD3}") Until $Pix <> 1 ;;;;;;;; Func Terminate() Exit 0 EndFunc EDIT: i didnt see urs sinister, lemme try that. i used toe window information thing but it still isnt finding it, ill try to fix it Edited December 15, 2005 by dre111 Link to comment Share on other sites More sharing options...
=sinister= Posted December 15, 2005 Share Posted December 15, 2005 (edited) uh, the color is correct in my script. Your on your own there. sry. BUT, I have a script that can get the color. I need to fix it, so when it's fixed, I will post it. **edit** There was an error in my script, edited and fixed. So if theres in error, try recopying it. Edited December 15, 2005 by =sinister= Link to comment Share on other sites More sharing options...
=sinister= Posted December 15, 2005 Share Posted December 15, 2005 Here is the program hotkeys- pause- exit insert- make mouse color background home- copy to clipboard -enjoyColor_Program.au3samples.bmp Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 15, 2005 Moderators Share Posted December 15, 2005 (edited) i entered it correctly, it runs with no errors, but its not detecting the color when it passes by, heres my code HotKeySet("{ESC}", "Terminate") Dim $Topx = 440 Dim $Topy = 297 Dim $Bottomx = 496 Dim $Bottomy = 317 Dim $Color = 0xDAB966 ;;;;; Do $Pix = PixelSearch($Topx, $Topy, $Bottomx, $Bottomy, $Color) Sleep("500") Send("{NUMPAD3}") Until $Pix <> 1 ;;;;;;;; Func Terminate() Exit 0 EndFunc EDIT: i didnt see urs sinister, lemme try that. i used toe window information thing but it still isnt finding it, ill try to fix it I thought you might run into a problem here, my apologies for not point something out. Using AutoInfo Tool, there are 2 options you have to look at: 1. Options\Coord Mode - I generally will use Client Coords - So when using an Opt("CoordMode") option... I would set my coord paramater to 2, but window coords would be 0, and screen is default at 1. 2. Options\Color Mode - Default is RGB, make sure it is on the Default when trying to locate your colour Hex or Dec. Opt("PixelCoordMode", 2); Step 1 above, may need to change the 2 Opt("SendKeyDelay", 1); Just incase you need to send quickly, you may want to send slower HotKeySet("{ESC}", "Terminate") Dim $Topx = 440 Dim $Topy = 297 Dim $Bottomx = 496 Dim $Bottomy = 317 Dim $Color = 0xDAB966 ;;;;; Do $Pix = PixelSearch($Topx, $Topy, $Bottomx, $Bottomy, $Color) Sleep("500") Send("{NUMPAD3}") Until IsArray($Pix) ;;;;;;;; Func Terminate() Exit 0 EndFunc Good Luck! @=sinister= ; you could have just showed the pixel portion, with a simple #include at the top Edit: @Larry - Wonderful idea...>> Until IsArray($Pix) --- Changed it in script above to that. Edited December 15, 2005 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
=sinister= Posted December 15, 2005 Share Posted December 15, 2005 oh, right... Lol.... Link to comment Share on other sites More sharing options...
dre111 Posted December 15, 2005 Author Share Posted December 15, 2005 thank you smoke, that worked, thanks a bunch for all your help every1 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