AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

suspend depending on pixel?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
nvus



Joined: 02 Aug 2007
Posts: 29

PostPosted: Tue May 20, 2008 9:28 pm    Post subject: suspend depending on pixel? Reply with quote

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
View user's profile Send private message
n-l-i-d
Guest





PostPosted: Tue May 20, 2008 9:34 pm    Post subject: Reply with quote

What about PixelGetColor and Suspend/Pause/Sleep?
Back to top
nvus



Joined: 02 Aug 2007
Posts: 29

PostPosted: Tue May 20, 2008 9:38 pm    Post subject: Reply with quote

n-l-i-d wrote:
What about PixelGetColor and Suspend/Pause/Sleep?

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
View user's profile Send private message
PurloinedHeart



Joined: 04 Apr 2008
Posts: 209
Location: Canada

PostPosted: Wed May 21, 2008 12:02 am    Post subject: Reply with quote

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
View user's profile Send private message
nvus



Joined: 02 Aug 2007
Posts: 29

PostPosted: Wed May 21, 2008 12:27 am    Post subject: Reply with quote

ok so i have my pixel hexcode, how do i retreive the X,Y position of the pixel?
Back to top
View user's profile Send private message
PurloinedHeart



Joined: 04 Apr 2008
Posts: 209
Location: Canada

PostPosted: Wed May 21, 2008 12:32 am    Post subject: Reply with quote

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
View user's profile Send private message
nvus



Joined: 02 Aug 2007
Posts: 29

PostPosted: Wed May 21, 2008 12:36 am    Post subject: Reply with quote

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
View user's profile Send private message
PurloinedHeart



Joined: 04 Apr 2008
Posts: 209
Location: Canada

PostPosted: Wed May 21, 2008 12:45 am    Post subject: Reply with quote

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
View user's profile Send private message
nvus



Joined: 02 Aug 2007
Posts: 29

PostPosted: Wed May 21, 2008 1:29 am    Post subject: Reply with quote

doesnt work
Back to top
View user's profile Send private message
sinkfaze



Joined: 18 Mar 2008
Posts: 139

PostPosted: Wed May 21, 2008 2:24 am    Post subject: Reply with quote

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
View user's profile Send private message
nvus



Joined: 02 Aug 2007
Posts: 29

PostPosted: Wed May 21, 2008 3:45 am    Post subject: Reply with quote

@sinkfaze

doesnt work, the script just pauses. i tried changing pause to suspend but it just suspends.
Back to top
View user's profile Send private message
nvus



Joined: 02 Aug 2007
Posts: 29

PostPosted: Wed May 21, 2008 5:09 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group