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 

Is it possible to group several clicks with a variable?

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





PostPosted: Mon Mar 01, 2010 2:33 am    Post subject: Is it possible to group several clicks with a variable? Reply with quote

I am very new to this, so this may be obvious, but is it possible to define several clicks with a variable and then just refer to the variable? I will be reusing a few click sets several times and for clarity I would like to use a variable (or something) rather then repeating the code. Example:

Option1 =
Click 754, 239, D
Sleep, 100
Click 754, 239, U
Sleep, 100
Click 756, 236, D
Sleep, 100
Click 756, 236, U
Sleep, 100
Click 331, 237, D
Sleep, 100
Click 331, 237, U
Sleep, 100

If someone could point me in the right direction that would be wonderful. Thanks for your help!
Back to top
Guest






PostPosted: Mon Mar 01, 2010 2:39 am    Post subject: Reply with quote

u can define a label for them and call them by using GoSub
Back to top
jl34567



Joined: 03 Jan 2010
Posts: 262

PostPosted: Mon Mar 01, 2010 2:55 am    Post subject: Reply with quote

GooSub would look like this

Code:

if sky=blue
  GoSub, Option1
else
if sky=gray
  GoSub, Option2
Return

Option1:
Click 754, 239, D
Sleep, 100
Click 754, 239, U
Sleep, 100
Click 756, 236, D
Sleep, 100
Click 756, 236, U
Sleep, 100
Click 331, 237, D
Sleep, 100
Click 331, 237, U
Sleep, 100
Return


Option2:
Some other crap here
Return
Back to top
View user's profile Send private message AIM Address
sinkfaze



Joined: 18 Mar 2008
Posts: 5044
Location: the tunnel(?=light)

PostPosted: Mon Mar 01, 2010 2:55 am    Post subject: Reply with quote

You could also use a function but a Gosub subroutine would probably work better.
_________________
Try Quick Search for Autohotkey or see the tutorial for newbies.
Back to top
View user's profile Send private message Send e-mail
poo_noo



Joined: 08 Dec 2006
Posts: 248
Location: Sydney Australia

PostPosted: Mon Mar 01, 2010 2:57 am    Post subject: Reply with quote

You could also put your click sets under particular keys. EG see below for F10 & F11 keys
Code:
F10::
Msgbox About to send clickset 1
Click 754, 239, D
Sleep, 100
Click 754, 239, U
Sleep, 100
Click 756, 236, D
Sleep, 100
Click 756, 236, U
Sleep, 100
Click 331, 237, D
Sleep, 100
Click 331, 237, U
Sleep, 100
Return

F11::
Msgbox About to send clickset 2
Click 754, 239, D
Sleep, 100
Click 754, 239, U
Sleep, 100
Click 756, 236, D
Sleep, 100
Click 756, 236, U
Sleep, 100
Click 331, 237, D
Sleep, 100
Click 331, 237, U
Sleep, 100
Return

_________________
Paul O
Back to top
View user's profile Send private message Visit poster's website
MasterFocus



Joined: 08 Apr 2009
Posts: 3035
Location: Rio de Janeiro - RJ - Brasil

PostPosted: Mon Mar 01, 2010 4:53 am    Post subject: Reply with quote

You could put those coordinates in a variable
with a delimiter and the use a Parsing Loop.
_________________
"Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried.
"

Antonio França
My stuff: Google Profile
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
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