 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Wed Nov 11, 2009 9:03 pm Post subject: PixelGetColor help please - if/else = same action :( |
|
|
Hey guys,
i have set up a macro using PixelGetColor.
script works, but its only and evey time doing the ELSE action [no matter if the statement is tru/false], and i cant figure what did i mess up.
any help please?
[its only a part of the script, and i`ll loop it, but left the loop part,and others out,untill i figure this one]
here is the code:
| Code: |
m::
{
PixelGetColor, color1, 78,360
if color1=0x9B8363
Sleep 10000
else
{
Send {2 down}
Sleep 50
Send {2 up}
Sleep 100
Send {LButton down}
Sleep 50
Send {Lbutton up}
Sleep 5000
}
}
return |
|
|
| Back to top |
|
 |
Carcophan
Joined: 24 Dec 2008 Posts: 768 Location: :noitacoL
|
Posted: Wed Nov 11, 2009 9:07 pm Post subject: |
|
|
Try these changes in 'red' and see if it helps
| Code: |
m::
PixelGetColor, color1, 78,360
if (color1 = 0x9B8363)
{
Sleep 10000
;your only action if the statment is true, is to wait 10 seconds?
return ;since you have no other actions? Check this
} ;you should not need the '{', '}' if all you are doing is sleeping 10 seconds
else
{
Send {2 down}
Sleep 50
Send {2 up}
Sleep 100
Send {LButton down}
Sleep 50
Send {Lbutton up}
Sleep 5000
}
return
|
_________________ "Unfortunately a "COM for Dummies" book would be a little like "Neurosurgery for Dummies," in the end you're just gonna have to learn" ~Tank
Last edited by Carcophan on Wed Nov 11, 2009 10:15 pm; edited 1 time in total |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Nov 11, 2009 9:17 pm Post subject: |
|
|
tried the changes u said:
- if i remove {} i get missing { error. - left them
return has been inserted, no help, still only ELSE actions are made,everytime  |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Nov 11, 2009 9:46 pm Post subject: |
|
|
| Code: | m::
PixelGetColor, color1, 78,360
If (color1 = "0x9B8363")
{
Sleep, 10000
Return
} else {
Send {2 down}
Sleep 50
Send {2 up}
Sleep 100
Send {LButton down}
Sleep 50
Send {Lbutton up}
Sleep 5000
}
Return |
|
|
| Back to top |
|
 |
Guest
|
Posted: Wed Nov 11, 2009 9:51 pm Post subject: |
|
|
Thx for u`r help, but not solving my problem.
somehow, its always doing the same thng, like wouldnt keep track aof the returned value,cause ELSE is executed,if true, and if false also.
 |
|
| Back to top |
|
 |
Carcophan
Joined: 24 Dec 2008 Posts: 768 Location: :noitacoL
|
Posted: Wed Nov 11, 2009 10:14 pm Post subject: |
|
|
Our code snippets should help you.
| Quote: | | its only a part of the script, and i`ll loop it, but left the loop part,and others out,untill i figure this one | Maybe something else is causing it to not function.
Next step is to post all of your code, for better assistance. _________________ "Unfortunately a "COM for Dummies" book would be a little like "Neurosurgery for Dummies," in the end you're just gonna have to learn" ~Tank |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Nov 11, 2009 10:43 pm Post subject: all the code |
|
|
all code,as it looks now [after 4 hours of searching around - as i`m a noob]
| Code: | CoordMode, ToolTip, Screen
m::
PixelGetColor, color1, 78,360, Alt
If (color1 = "0x9B8363")
{
SoundBeep, 200, 10000
Return
} else {
Send {2 down}
Sleep 50
Send {2 up}
Sleep 100
Send {LButton down}
Sleep 50
Send {Lbutton up}
Sleep 5000
}
Return |
|
|
| Back to top |
|
 |
drmartell
Joined: 23 Feb 2008 Posts: 19
|
Posted: Wed Nov 11, 2009 11:04 pm Post subject: |
|
|
I've been working with PixelSearch lately and I like to use this small script just to see if it is finding / not finding the target color correctly:
This makes the assumption that Notepad is your target window, change as needed:
| Code: | CoordMode, Pixel, Screen
CoordMode, Mouse, Screen
#p::
WinGetPos, X, Y, Width, Height, Notepad
PixelSearch, Px, Py, X, Y, X+Width, Y+Height, 0x9B8363, 0, Slow
if ErrorLevel
{
MouseMove, X, Y
MsgBox, That color was not found: %x% %y% %width% %height%.
}
else
{
MouseMove, Px, Py
MsgBox, Your color was found at X%Px% Y%Py%.
}
Return |
Could do something similar to create msgboxes for PixelGetColor to tell you if it is behaving the way to are looking for. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|