::hi::
abc()
return
::there::
abc()
return
::blue::
def()
return
::sky::
def()
return
; .... and lots more hotkeys needing abc() and def() fx applied
abc()
{
}
def()
{
}
Applying same function over a group of hotstrings
Started by
jrav
, May 31 2012 08:24 AM
3 replies to this topic
#1
Posted 31 May 2012 - 08:24 AM
Is there a more elegant way (less lines) to achieve this? I'm trying to understand the flow of a script better, especially in relation to hotstrings and functions, and it may be mainly an issue where I place things on the script. Thanks for your help!
#2
Guests
Posted 31 May 2012 - 08:26 AM
::hi:: ::there:: ::this:: ::is:: ::how:: ::you:: ::do:: ::it:: abc() return
#3
Posted 31 May 2012 - 09:07 AM
Awesome! That was answer to one of my ?s...
Now to make things a little more complicated..what if I have some unique commands but still use the same function between a group of hotkeys:
Now to make things a little more complicated..what if I have some unique commands but still use the same function between a group of hotkeys:
::hi:: abc() sendinput hi return ::there:: abc() a := greets return abc() return
#4
Guests
Posted 31 May 2012 - 09:51 AM
You could handle that in your function by using A_ThisHotkey
::hi::
::there::
abc()
return
abc()
{
MsgBox % SubStr(A_ThisHotkey,3)
}
Instead of the MsgBox above you can use a If Else Structure to do specific things for each hotstringIf (SubStr(A_ThisHotkey,3) = "hi")
{
; do something
} Else If (SubStr(A_ThisHotkey,3) = "there")
{
} ; etc ...




