b92ba Posted May 16, 2010 Share Posted May 16, 2010 hi, I'm new to this site and i don't know how to write a script. my idea of the script is i want to push a certain key down when the pixel color change and let the key when the pixel color goes to normal. can someone write me an example... thank you best regards, b92ba Link to comment Share on other sites More sharing options...
JohnOne Posted May 16, 2010 Share Posted May 16, 2010 Sounds like a spamming script you want, so you'll be lucky if someone just comes along and makes it for you, its all about getting help with your efforts here rather than getting scripts written for you. Heres what you want to be looking for in the helpfile Pixelgetcolor Send Both have examples in the helpfile so you should be off to a flying start Best of luck AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
b92ba Posted May 16, 2010 Author Share Posted May 16, 2010 Thanks for your time, im looking to the help file wright now it's very useful... may be i can write my first script in here so u guys have a look at and tell me if something is wrong TY Link to comment Share on other sites More sharing options...
JohnOne Posted May 16, 2010 Share Posted May 16, 2010 absolutely. try it out, and post if you are having problems with an aspect of your code. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
b92ba Posted May 17, 2010 Author Share Posted May 17, 2010 this is what i came up withFunc Test() $pixel = PixelGetColor( 444, 463 ) $hexpixel = Hex($pixel, 6) $hhexpixel = '0x' & $hexpixel $safety = 0 if $hhexpixel <> 0x787474 and $hhexpixel <> 0xAF8809 and $safety = 0 then $safety = 1 Sleep(75) Send("{1 down}") Sleep(25) else $safety = 0 Send("{1 up}") endif EndFunc While 1=1 Test() WEndthis is a screen of the what I'm trying to dothe problem is the script keep pushing the "1" repetitively. Link to comment Share on other sites More sharing options...
JohnOne Posted May 17, 2010 Share Posted May 17, 2010 It does that because you have the function in an endless while loop, and also without a sleep() in it, and with no means of exiting. Also, If you are going to keep calling the function in this manner you might want to put your $safety variable outside of it, because its always going to be 0 while in the loop. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
b92ba Posted May 17, 2010 Author Share Posted May 17, 2010 ok i'll think of a solution Link to comment Share on other sites More sharing options...
JohnOne Posted May 17, 2010 Share Posted May 17, 2010 firstly Just try removing the first instance of "$safety = 0" and pasting it here $safety = 0 While 1=1 Test() WEnd AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
b92ba Posted May 17, 2010 Author Share Posted May 17, 2010 (edited) good point, but i guess the real problem is there is a lot of pixel color changes, so maybe i need a range of colors or something like that. i thinking ... $RedColor = _ColorGetRed( $hhexpixel ) if $RedColor > 146 should that work? Edited May 17, 2010 by b92ba 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