Jump to content

New to auto it, need help with "If" command script


Recommended Posts

Hi I'm trying to incorporate into my script a command that is dependent on the color of a specific pixel on my screen.

Could someone who is good at this help me out please? Basically I have a script right now for pressing space every few seconds,

and I want to add in a variable that if a specific pixel on my screen was green, it would execute some button press commands, and if

it wasn't green, would just do nothing and continue pressing space on a loop.

How can I write in a command that is dependent on the color of a specific pixel? I can find out the coords for the pixel if you can help

me for where to input them in a script, if what I want to do is possible. Thank you much!

(Very new to this, one day, been reading the tutorials but im not the best at computery stuff.)

Link to comment
Share on other sites

Maybe:

HotKeySet("{F9}", "Start")
 HotKeySet("{F10}", "End")
 
 While 1
     Sleep(100)
 WEnd
 
 Func Start()
     If Hex(PixelGetColor( 10, 100 ), 6) <> 0xFF00FF Then Return ; 0xRRGGBB
 
     While 1
         Sleep(40000 + Random(1, 50, 1))
         Send("{SPACE}")
         Sleep(200)
         Send("{SPACE}")
         Sleep(18000 + Random(4000, 6000, 1))
     WEnd
 EndFunc   ;==>Start
 
 Func End()
     Exit
 EndFunc   ;==>End

EDIT: change X,Y and color accordingly

Edited by Zedna
Link to comment
Share on other sites

ok I checked out the getcolor command,

and the pixel color I want it to check for and execute movements on is

pixel: 90,142

dec color: 29696

hex color: 007400

So now how can I make a command that will only execute when pixel 90, 142 is this color?if the pixel is not that color

I want it only to continue my space loop.

tyvm for the help so far!

edit: oh and the command I want to add in is some arrow movements then pressing the "1" button, if you wanted to know

Edited by powderedonuts
Link to comment
Share on other sites

ugh Im really bad I need help on how to input the colors.

HotKeySet("{F9}", "Start")

HotKeySet("{F10}", "End")

While 1

Sleep(100)

WEnd

Func Start()

If Hex(PixelGetColor( 90, 142 ), 6) <> 0xFF00FF Then Return ; 0x007400

Send("{SPACE}")

Sleep(200)

Send("{SPACE}")

Sleep(200)

While 1

Sleep(40000 + Random(1, 50, 1))

Send("{SPACE}")

Sleep(200)

Send("{SPACE}")

Sleep(18000 + Random(4000, 6000, 1))

WEnd

EndFunc ;==>Start

Func End()

Exit

EndFunc ;==>End

this is wrong right? I want the two SPACE to be conditional on the color

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...