Jump to content
Sign in to follow this  
bu66le

hotkeyset function

Recommended Posts

bu66le

Is there a way to pass parameter(s) to the function call by hotkeyset? eg. how do I pass a parameter to TogglePause for hotkey defined as followed:

HotKeySet("{PAUSE}", TogglePause")

Share this post


Link to post
Share on other sites
Thatsgreat2345

either have a Hotkeyset call a func that calls a function with paramaters or try looking at _ispressed with an if then , but i remember a topic on this not to long ago, i think it was resolved as a no you cant

Share this post


Link to post
Share on other sites
exodius

Not sure if this is what you mean, but based on how I read what you said...

HotKeySet("a", "ParameterFunction")
 
 While 1
     Sleep ( 100 )
 WEnd

Func ParameterFunction()
    ActualFunction ("These words are magic!")
EndFunc

Func ActualFunction($MagicWords)
    MsgBox ( 0, "", $MagicWords)
EndFunc

Share this post


Link to post
Share on other sites
Thatsgreat2345

well using ur example he wanted it to have the hotkey set wtih the Actualfunction("These Words are Magic!") as the function so it directly calls the function with the paramaters but the way you showed i believe is the only way around it

Share this post


Link to post
Share on other sites
bu66le

basically, I would like to pass a parameter to the same function from different hotkeysets. It looks something like this but this code will not work:

HotKeySet("^#1", "GoOnline('www.google.com')")
HotKeySet("^#2", "GoOnline('www.yahoo.com')")

Func GoOnline($site)
   ;do something
EndFunc

Maybe thatsgreat2345 is right, I can't.

Thanks.

Share this post


Link to post
Share on other sites
exodius

Maybe thatsgreat2345 is right, I can't.

I think this line is true. :D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.