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 

where's my mistake in this getpixelcolor script

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





PostPosted: Tue Aug 26, 2008 1:21 pm    Post subject: where's my mistake in this getpixelcolor script Reply with quote

Hello everyone
can someone tell me where my problem is in this script

What I'm trying to get it to do is : when there's a black color in a certain place then a certain action is undertakin automatically.
Code:
CoordMode, Pixel, Relative
loop
{
WinWait, XAU/USD - 1 min,
IfWinNotActive, XAU/USD - 1 min, , WinActivate, XAU/USD - 1 min,
WinWaitActive, XAU/USD - 1 min,
sleep, 100
PixelGetColor, 0x000000, 605, 853
if (color >= 0x000000 && color <= 0x000000)
{
WinWait, XAU/USD - 1 min,
IfWinNotActive, XAU/USD - 1 min, , WinActivate, XAU/USD - 1 min,
WinWaitActive, XAU/USD - 1 min,
MouseClick, right,  948,  451
Sleep, 100
MouseClick, left,  999,  490
Sleep, 100
WinWait, Market Order,
IfWinNotActive, Market Order, , WinActivate, Market Order,
WinWaitActive, Market Order,
Send, 500
MouseClick, left,  176,  469
Sleep, 100
MouseClick, left,  366,  158
Sleep, 100
}
else
{
break
}
}

D::ExitApp

thanks so much if anyone could help I
Back to top
BoBo²
Guest





PostPosted: Tue Aug 26, 2008 3:57 pm    Post subject: Reply with quote

Code:
PixelGetColor, OutputVar, 605, 853
if (OutputVar != "0x000000")
RTFM.
Back to top
hotkeybegginer
Guest





PostPosted: Tue Aug 26, 2008 6:30 pm    Post subject: Reply with quote

IT seems that now it doesn't respect the "if". Even when that area isn't yellow (I switched to yellow) it undertakes all the commands anyways.
so it still isn't working
Code:
loop
{
sleep, 100
PixelGetColor, OutputVar, 1170, 851
if (OutputVar != "0x93F6FE")
{
MouseClick, right,  1031,  180
Sleep, 100
MouseClick, left,  1062,  221
Sleep, 100
Send, 500
MouseClick, left,  167,  229
Sleep, 100
MouseClick, left,  372,  155
Sleep, 100
Send, {ENTER}
Sleep, 100
MouseClick, left,  376, 158
Sleep, 100
MouseClick, left,  372, 160
Sleep, 100
MouseClick, left,  374, 158
Sleep, 100
MouseClick, left,  378, 158
Sleep, 100
MouseClick, left,  372, 160
Sleep, 100
MouseClick, left,  374, 158
Sleep, 100
MouseClick, left,  376, 157
Sleep, 100
MouseClick, left,  377, 156
Sleep, 100
MouseClick, left,  374, 158
Sleep, 100
break
}
else
{
continue
}
}


Yes, i've been reading the manual but since I don't know anything about computers it's very hard to understand.

thanks in advance
I think it's probably really easy it's just something that i'm missing
Back to top
[VxE]



Joined: 07 Oct 2006
Posts: 1496

PostPosted: Tue Aug 26, 2008 10:41 pm    Post subject: Reply with quote

If you get the color of apixel that is outside the screen, it seems to return a value of 0xFFFFFFFF, which may be what's happening in your case. Also, be sure to set CoordMode correctly.
_________________
My Home Thread
More Common Answers: [1]. It's in the FAQ [2]. Ternary ( a ? b : c ) guide [3]. Post code inside [code][/code] tags !
Back to top
View user's profile Send private message
DataLife



Joined: 27 Apr 2008
Posts: 104

PostPosted: Wed Aug 27, 2008 12:18 am    Post subject: Reply with quote

Just a suggestion. Use WinSpy to make sure the color you are looking for is at the x and y coordinates you have it set to look. In my experiences just because the box looks yellow not all pixels in the box have the yellow color code.

You could try putting "Alt" or "Slow" as the last parameter.

Also as [VXE] suggested try CoordMode.

DataLife
Back to top
View user's profile Send private message Send e-mail
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