Jump to content
Sign in to follow this  
b92ba

click when change of color

Recommended Posts

b92ba

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

Share this post


Link to post
Share on other sites
JohnOne

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.

Share this post


Link to post
Share on other sites
b92ba

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

Share this post


Link to post
Share on other sites
b92ba

this is what i came up with

Func 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()
WEnd

this is a screen of the what I'm trying to do

Posted Image

the problem is the script keep pushing the "1" repetitively.

Share this post


Link to post
Share on other sites
JohnOne

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.

Share this post


Link to post
Share on other sites
b92ba

ok i'll think of a solution

Share this post


Link to post
Share on other sites
b92ba

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 by b92ba

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×