Jump to content
Sign in to follow this  
Ejoc

HotKeySet and Optional Parameter

Recommended Posts

Ejoc

So I set an optional parameter to see if I call it via a menu or via HotKey, this is a simplified example:

The first 2 calls to test() work as expected, but when I call it w/ the hotkey a, it breaks...

EDIT

I know I can check @NUMPARAMS it see if a param was passed, but it seems like something is broken.

If Not @NUMPARAMS Then local $opt_param = 0

Global $i
HotKeySet("a","test")

test(1)
test()

$i = 1
while $i
    sleep(250)
WEnd

Func test($opt_param = 0)
    MSGBox(0,"","$opt_parm = " & $opt_param)
    $i = 0
EndFunc
Edited by Ejoc

Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

Share this post


Link to post
Share on other sites
Jos

:) ... strange, guess this needs to be checked....

here's a work around:

Global $i
HotKeySet("a","test")

test(1)
test()

$i = 1
while $i
    sleep(250)
WEnd

Func test($opt_param = 0)
    if not IsDeclared("opt_param") then $opt_param = 0
    MSGBox(0,"","$opt_parm = " & $opt_param)
    $i = 0
EndFunc

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Ejoc

That works, thanks. Does seem to be broken tho.


Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs

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  

×