Sign in to follow this  
Followers 0
confucion

HotKeySet Question

2 posts in this topic

Is it possible to send a value to a function triggered by a HotKeySet?

I tried this at first but it doesn't work.

HotKeySet("q", "q_func(5)")

Func q_func($value)
  $total = $value + 10
  MsgBox(4096,"",$value & " + 10 = " & $total)
endFunc

I altered it a bit like this, some improvement because it at least shows a msgbox with the correct $total but it doesn't wait for me to press the HotKey, it just runs as soon as it reads q_func(5).

HotKeySet("q", q_func(5))

Func q_func($value)
  $total = $value + 10
  MsgBox(4096,"",$value & " + 10 = " & $total)
endFunc

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Seems to me it is not possible to send a value to a function directly - at least, I couldn't get it done.

However, you could avoid it by using a second function:

HotKeySet("q", "q_func1")
$total = 0
While 1
    Sleep(100)
WEnd


Func q_func1()
  q_func2(5)
endFunc

Func q_func2($value)
  $total = $value + 10
  MsgBox(4096,"",$value & " + 10 = " & $total)
endFunc

Stupid, but working :)

Edited by Marc

It's my job to comfort the disturbed and to disturb the comfortable.

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  
Followers 0