Jump to content
Sign in to follow this  
Todd Bauer

Hotkeyset: Can I Pass A Parameter To The Function?

Recommended Posts

Todd Bauer

My current code is this...

HotKeySet ("!^t","WriteTrigger") ;call the WriteTrigger fuction when Ctrl-Alt-T is pressed

I wish I could do this...

HotKeySet ("!^t","WriteTrigger("TriggerA")") ;call the WriteTrigger fuction with "TriggerA" parameter when Ctrl-Alt-T is pressed

I tried using double quotes and stuff such as...

HotKeySet ("!^t","WriteTrigger(""TriggerA"")")

but it doesn't like that either. I am I having a brain problem, or is this not supported?

Thanks in advance.

T

Share this post


Link to post
Share on other sites
Valik

It's not supported. HotKeySet (Call and AdlibEnable as well) only take the name of a callback function.

Share this post


Link to post
Share on other sites
Todd Bauer

OK, thanks. Just wanted to make sure before I make my code overly bloated. I suppose the function can just call another function with the parameter I want.

Long live AutoIt !!!!

Share this post


Link to post
Share on other sites
scriptkitty

use:

HotKeySet ("!^t","WriteTrigger1") 

while 1
sleep(10)
wend


func WriteTrigger($x)
msgbox(1,$x,"")
endfunc

func WriteTrigger1()
WriteTrigger("TriggerA")
endfunc

AutoIt3, the MACGYVER Pocket Knife for computers.

Share this post


Link to post
Share on other sites
Josbe

Once I did myself this question.

It would not be fine that could be passed arguments? :huh2:

For don't create more user functions in the script. (as scriptkitty's example) :D

Share this post


Link to post
Share on other sites
Todd Bauer

scriptkitty,

That's exactly what I did. Defined a set of hotkeys that called a function that called the 'real' function the way I wanted it. Works great, just a few more lines of code than I want.

T

Long Live AutoIt !!

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.