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 

help with pixel search

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



Joined: 28 Jan 2007
Posts: 42

PostPosted: Fri Jun 13, 2008 12:41 am    Post subject: help with pixel search Reply with quote

I need help writing my code... i need to write a program that when a certain pixel(specified in code below) turns white is sends "send, #p" and when i click the windows key+s is sends #p again.... once this process is complete, it restarts searching for the white pixel. here is my code, can someone please tell me what i did wrong?


Code:
#a::
loop
{
loop
{
PixelSearch, Px, Py, 276, 231, 278, 233, FFFFFF, 0, Fast
}

sleep, 100

send, #P

#s::

sleep, 100

send, #p
}
Back to top
View user's profile Send private message
Guest






PostPosted: Fri Jun 13, 2008 1:08 am    Post subject: Reply with quote

you can't put hotkey:: inside brackets
Back to top
Crusader



Joined: 28 Jan 2007
Posts: 42

PostPosted: Fri Jun 13, 2008 4:27 am    Post subject: Reply with quote

besides that, what else is wrong?..... can someone please fix what is wrong really quickly, thank you
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 6847
Location: Pacific Northwest, US

PostPosted: Fri Jun 13, 2008 4:40 am    Post subject: Reply with quote

Code:

#a::
next = 0
loop
{
PixelSearch, Px, Py, 276, 231, 278, 233, FFFFFF, 0, Fast
if (Px)
  break

}

sleep, 100

send, #P
loop
  if (next)
    break
sleep, 100

send, #p
return

#s::
next = 1
return

_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
[VxE]



Joined: 07 Oct 2006
Posts: 1495

PostPosted: Fri Jun 13, 2008 7:35 am    Post subject: Reply with quote

Code:
#a::SetTimer, WatchForAPixel, 100

WatchForAPixel:
loop
{
   PixelSearch, Px, Py, 276, 231, 278, 233, FFFFFF, 0, Fast
   If (ErrorLevel)
      Sleep 10
   Else
      Break
}

sleep, 100
send, #P

Win_S_flag := 0

Loop
{
   If (Win_S_flag = 0)
      sleep 10
   else
      break
}

sleep, 100
send, #p

return

#p::Win_S_flag := 1
untested
_________________
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
Crusader



Joined: 28 Jan 2007
Posts: 42

PostPosted: Fri Jun 13, 2008 8:06 pm    Post subject: Reply with quote

ok, thanks guys, ill try these out when i get home. I really appreciate your help.
Back to top
View user's profile Send private message
Crusader



Joined: 28 Jan 2007
Posts: 42

PostPosted: Sat Jun 14, 2008 4:58 am    Post subject: Reply with quote

hmmmm.... im afraid neither of these work for me... do you think something is wrong with my computer?
Back to top
View user's profile Send private message
[VxE]



Joined: 07 Oct 2006
Posts: 1495

PostPosted: Sat Jun 14, 2008 6:33 am    Post subject: Reply with quote

Code:
#a::SetTimer, WatchForAPixel, 100

WatchForAPixel:
loop
{
   PixelSearch, Px, Py, 276, 231, 278, 233, 0xFFFFFF, 0, Fast
   If (ErrorLevel)
      Sleep 10
   Else
      Break
}

sleep, 100
send, #P

Win_S_flag := 0

Loop
{
   If (Win_S_flag = 0)
      sleep 10
   else
      break
}

sleep, 100
send, #p

return

#p::Win_S_flag := 1
oops
_________________
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
Crusader



Joined: 28 Jan 2007
Posts: 42

PostPosted: Sat Jun 14, 2008 8:36 pm    Post subject: Reply with quote

man.... this code doesn't work for me either, if you need to, you could make it as simple as... when that pixel turns white, it presses #p then exits out of the application....just as long as THAT works! thanks...
Back to top
View user's profile Send private message
[VxE]



Joined: 07 Oct 2006
Posts: 1495

PostPosted: Sat Jun 14, 2008 10:22 pm    Post subject: Reply with quote

maybe you don't ever have a white pixel for the code to detect Razz Try having the pixel search loop display a tooltip with the found XY and errorlevel.

Just saying that code "doesn't work" won't help anyone trying to help you.
_________________
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
Guest






PostPosted: Sat Jun 14, 2008 10:23 pm    Post subject: Reply with quote

no matter what i try, when there is an error, (FFFFFF is not found) it still breaks the loop. what can i do to fix this?
Back to top
[VxE]



Joined: 07 Oct 2006
Posts: 1495

PostPosted: Sat Jun 14, 2008 10:34 pm    Post subject: Reply with quote

Maybe you're missing Coordmode, pixel, screen above the pixelsearch, but it's anyone's guess....

btw: the "0x" needs to be in front of "FFFFFF" to even have a chance of working.
_________________
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
Guest






PostPosted: Sun Jun 15, 2008 2:42 am    Post subject: Reply with quote

i found an alternative way to do this...is there a way to pixelsearch, while doing something else, like while surfing the net, and have the script search a minimised window?
Back to top
Krogdor



Joined: 18 Apr 2008
Posts: 1145
Location: The Interwebs

PostPosted: Sun Jun 15, 2008 5:55 am    Post subject: Reply with quote

Nope, PixelSearch only sees what you see.
Back to top
View user's profile Send private message AIM Address
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