AutoHotkey Community

It is currently May 27th, 2012, 11:54 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: September 27th, 2010, 9:58 pm 
Offline

Joined: November 22nd, 2008, 9:52 pm
Posts: 44
Code:
t1=0x80fefe
t2=0x401cfe
t3=0xfc8612

Color(x1,y1,x2,y2,cvjat)
{
pixelsearch,cox,coy,%x1%,%y1%,%x2%,%y2%,%cvjat%,40,fast
if(errorlevel=0)
   return cvjat
else
   return 0
}

#1::
color:=color(100,100,200,200,t1)
If(color=0)
color:=color(100,100,200,200,t2)
If(color=0)
color:=color(100,100,200,200,t3)
mousemove, cox, coy
msgbox, %color%

How can I "extract" cox and coy from the funcion ? They return as blank values ...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 27th, 2010, 10:30 pm 
Offline

Joined: August 25th, 2009, 4:52 pm
Posts: 321
Code:
t1=0x80fefe
t2=0x401cfe
t3=0xfc8612

Color(x1,y1,x2,y2,cvjat)
{
   global
pixelsearch,cox,coy,%x1%,%y1%,%x2%,%y2%,%cvjat%,40,fast
if(errorlevel=0)
   return cvjat
else
   return 0
}

#1::
color:=color(100,100,200,200,t1)
If(color=0)
color:=color(100,100,200,200,t2)
If(color=0)
color:=color(100,100,200,200,t3)
mousemove, cox, coy
msgbox, %color%


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 27th, 2010, 11:26 pm 
Offline

Joined: November 28th, 2009, 4:45 am
Posts: 3089
You can also use ByRef Variables
Code:
t1=0x80fefe
t2=0x401cfe
t3=0xfc8612

Color(x1,y1,x2,y2,cvjat,ByRef cox,ByRef coy)
{
pixelsearch,cox,coy,%x1%,%y1%,%x2%,%y2%,%cvjat%,40,fast
if(errorlevel=0)
   return cvjat
else
   return 0
}

#1::
color:=color(100,100,200,200,t1,a,b)
If(color=0)
color:=color(100,100,200,200,t2,a,b)
If(color=0)
color:=color(100,100,200,200,t3,a,b)
mousemove, a, b
msgbox, %color%


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 28th, 2010, 2:30 am 
Offline

Joined: April 8th, 2009, 8:23 pm
Posts: 3036
Location: Rio de Janeiro - RJ - Brasil
None wrote:
You can also use ByRef Variables

And they can also be made optional by adding "=0" after each one.

_________________
"Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried.
"
Image
Antonio França
My stuff: Google Profile


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 28th, 2010, 5:16 am 
Offline

Joined: August 21st, 2006, 7:07 pm
Posts: 2925
Location: The Shell
I had the same general question here.
ByRef solved it for me!
There are some other pretty amazing examples posted too.


Now if AHK could only get ByVal :mrgreen: !

_________________
Imageparadigm.shift:=(•_•)┌П┐RTFM||^.*∞


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey and 17 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group