| View previous topic :: View next topic |
| Author |
Message |
nvus
Joined: 02 Aug 2007 Posts: 29
|
Posted: Tue May 20, 2008 9:28 pm Post subject: suspend depending on pixel? |
|
|
is it possible to suspend and unsuspend a script depending on what color pixel is being shown at a certain area/coordinate?
example:
i choose coordinates 21,40 on the window. if the pixel at 21,40 is blue then suspend the script, if its green then unsuspend the script |
|
| Back to top |
|
 |
n-l-i-d Guest
|
|
| Back to top |
|
 |
nvus
Joined: 02 Aug 2007 Posts: 29
|
Posted: Tue May 20, 2008 9:38 pm Post subject: |
|
|
actually, i'm looking at those now.
how do i retreive a certain pixel color and position? how do i know the the hexcode is for the color and the x,y |
|
| Back to top |
|
 |
PurloinedHeart
Joined: 04 Apr 2008 Posts: 209 Location: Canada
|
Posted: Wed May 21, 2008 12:02 am Post subject: |
|
|
| Quote: |
how do i retreive a certain pixel color and position?
|
As the users above stated, use PixelGetColor
| Quote: |
how do i know the the hexcode is for the color and the x,y
|
http://www.steves-templates.com/guide/color.gif
or use window spy |
|
| Back to top |
|
 |
nvus
Joined: 02 Aug 2007 Posts: 29
|
Posted: Wed May 21, 2008 12:27 am Post subject: |
|
|
| ok so i have my pixel hexcode, how do i retreive the X,Y position of the pixel? |
|
| Back to top |
|
 |
PurloinedHeart
Joined: 04 Apr 2008 Posts: 209 Location: Canada
|
Posted: Wed May 21, 2008 12:32 am Post subject: |
|
|
You can use the window-spy thign that coems with autohotkey or use this script..
| Code: |
#LButton::
MouseGetPos, X, Y
Msgbox, X:%x%`nY:%Y%
ExitApp
|
Just hold down the windowskey and click
If you want a position on the screen, and not in the active window, use
| Code: |
CoordMode, Mouse, Screen
#LButton::
MouseGetPos, X, Y
Msgbox, X:%x%`nY:%Y%
ExitApp
|
|
|
| Back to top |
|
 |
nvus
Joined: 02 Aug 2007 Posts: 29
|
Posted: Wed May 21, 2008 12:36 am Post subject: |
|
|
thanks PurloinedHeart but i decided to use
z::
MouseGetPos, MouseX, MouseY
PixelGetColor, color, %MouseX%, %MouseY%
MsgBox The color at the current cursor position is %color%.
return
x::
MouseGetPos, xpos, ypos
Msgbox The cursor is at X%xpos% Y%ypos%.
return
coordinates are 54, 787 and pixel is 0x101010
im not sure how to incorporate this into one of my scripts so that if 54,787 = 0x101010 then Unsuspend the script, otherwise suspend |
|
| Back to top |
|
 |
PurloinedHeart
Joined: 04 Apr 2008 Posts: 209 Location: Canada
|
Posted: Wed May 21, 2008 12:45 am Post subject: |
|
|
| Code: |
Loop{
PixelGetColor, PixelColor, 54, 787 ;Get pixel color, and store in variable PixelColor
if PixelColor != 0x10101
Continue
else ;if PixelColor is 0x10101
Break
}
|
Not tested |
|
| Back to top |
|
 |
nvus
Joined: 02 Aug 2007 Posts: 29
|
Posted: Wed May 21, 2008 1:29 am Post subject: |
|
|
| doesnt work |
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 139
|
Posted: Wed May 21, 2008 2:24 am Post subject: |
|
|
Untested:
| Code: | SetTimer, ColorFind, 100
return
ColorFind:
PixelSearch, Px, Py, 54, 787, 55, 788, 0x10101, 3, Fast
if ErrorLevel
return
else
{
Pause, On
return
} |
_________________ Have trouble searching the site for information? Try Quick Search for Autohotkey. |
|
| Back to top |
|
 |
nvus
Joined: 02 Aug 2007 Posts: 29
|
Posted: Wed May 21, 2008 3:45 am Post subject: |
|
|
@sinkfaze
doesnt work, the script just pauses. i tried changing pause to suspend but it just suspends. |
|
| Back to top |
|
 |
nvus
Joined: 02 Aug 2007 Posts: 29
|
Posted: Wed May 21, 2008 5:09 pm Post subject: |
|
|
is it possible to do something like
| Code: | if GetPixelColor [at] MousePos 55,787 != 0x101010
Suspend, On
else
Suspend, Off |
i know [at] isnt useable but i donno how else to explain what i want |
|
| Back to top |
|
 |
|