Sign in to follow this  
Followers 0
Fargo

What?! No Functions without Parameters but Optional!

7 posts in this topic

Func CLOSEClicked($msg="", $mopt=0)
  MsgBox($mopt, $LangAry[$langID][1], $msg)
  Exit
EndFunc

If I call the above function without passing any var, then autoit complains! It says $mopt is used without being declared. It seems functions in autoit cannot have all parameters as optional, right? :whistle:

Thank you

Share this post


Link to post
Share on other sites



Worked fine for me beta .132

CLOSEClicked()
Func CLOSEClicked($msg = "", $mopt = 0)
  MsgBox($mopt, '', $msg)
  Exit
EndFunc
Of course I had to take out the $LangAry[$langID][1] :whistle:

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Worked fine for me beta .132

CLOSEClicked()
Func CLOSEClicked($msg = "", $mopt = 0)
  MsgBox($mopt, '', $msg)
  Exit
EndFunc
Of course I had to take out the $LangAry[$langID][1] :whistle:
$LangAry and $langID are globally defined.

I think this is a bug! I only get the error msg when the function is called by GUICtrlSetOnEvent. When I call the function directly, no error is given!

Share this post


Link to post
Share on other sites

That's not a bug, that's a feature that isn't supported.

Share this post


Link to post
Share on other sites

I tested this with the latest beta and the problem is still there.

To work around this, you need to define vars at the beginning of the script with Global.

Share this post


Link to post
Share on other sites

That's not a bug, that's a feature that isn't supported.

Ah, that you Valik. I think I need to live with this then :whistle:

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