Doodec Posted January 13, 2011 Posted January 13, 2011 (edited) Hi GuysFirst, please forgive me if this question is noobish but im just starting with AutoIt. I used search option and googled the problem but the only similar subject found give me the example of code below.Source: Func _NG $n = PixelGetColor(386, 45) $g = PixelGetColor(380, 43) $ngd = 0 Select Case $n = 0x00FFFF and $g = 0x00FFFF and $ngd = 0 send("{g down}" & "{n down}") $ngd = 1 Case $n <> 0x00FFFF and $g <> 0x00FFFF and $ngd = 1 send("{g up}" & "{n up}") EndSwitch endfunc While 1 _NG() _G() _N() WendI can clarly understand the code above but cant write similar one to work the way I planned.Making long story short: I need script to check if X,Y Pixel COlor = Black is True THEN check if another X,Y Pixel COlor is one of other FIve colors. If the aboove conditions are met then script waits for me to push triger button to send keystroke.The Black Pixels may appear in three possible X,Y positions (2nd Black pixel will not appear if the key to triger is not pressed so there is no point in tracking all three Black to appear at the same time). Read further please... I hope It will become more clear..)1BlackX=3421BlackY=4252BlackX=3772BlackY=4233BlackX=4543BlackY=357The Colour Pixels may appear in three possible X,Y positions. (under 1Black, 2Black, 3Black)1ColorX=3411ColorY=4362ColorX=3782ColorY=4363ColorX=4543ColorY=436The Colour Pixels Codes are (taken from AutoIt Window Info) red, blue, white, green, yellow.black=0x000000white=0xFFFFFF corresponding key to press = gred=0x0000FF corresponding key to press = hyellow=0x00FFFF corresponding key to press = jblue=0xFF0000 corresponding key to press = kgreen=0x00FF00 corresponding key to press = lThe Keystrokes areg h j k lActivator;So the script should :1) Look for 1Black pixel to appear (342,425) if true then2) Get Pixel color from 1color (341,436) and then send coresponding Key (g,h,j,k or l) and wait and send it but only after I press ";" (activator) key. If activator not pressed wait 4 sec and start again from begining.3) If activator pressed4) Look for 2Black pixel to appear (377,423) - if not start from beginning.5) Get Pixel color from 2color (377,436) and then send coresponding Key (g,h,j,k or l) and wait and send it but only after I press ";" (activator) key. If activator not pressed wait 4 sec and start again from begining.6) If activator pressed look for 3Black to appear .... LoopUfff.... I made a long story after all I explained as clear as possible. After a few days searching and trying to write it myself I gave up. The necessary code is just to complicated for newbie like me. I know its time consuming but is there a chance that any of you guys could help me in relation to the above??? Thanks and regardsPS. Apologies for my English. Edited January 13, 2011 by Doodec
Doodec Posted January 17, 2011 Author Posted January 17, 2011 It took me almost whole weekend but I did it myself Topic to be closed.
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