Jump to content
Sign in to follow this  

My OnEvent UDF

Recommended Posts


I created one too :)

It supports hotkeys, GUI events, and tray events.

You can add parameters to be passed to the function.

If you specify "Exit" as the function (which is an unavailable function name :shhh: ) it calls Exit.

You can then define OnAutoItExit() to clean up or save settings :lmao:

Leave the function parameter blank to remove the event.

I just realised it's undocumented... It does quite speak for itself though :think:


#include <OnEvent.au3>

_HotKeySet("^{F1}", "_MyHotKeyFunc", "Hello, World!")
_HotKeySet("^{F2}", "_MyHotKeyFunc", "Param1, Param2")

While 1

Func _MyHotKeyFunc($Param1, $Param2)
    MsgBox(0, $Param1, $Param2)


- Takes in a string containing the parameters delimited by commas, therefore not setting any limit to the amount of parameters (only limit is string length), and I prefer strings over arrays ^^

Few disadvantages/bugs:

- No ByRef support (yet)

- If a parameter contains a comma, the result will not be as expected (As demonstrated above. Using an array instead of a string for the parameters would solve this).


Comments are always welcome.


Edited by Denny577

Share this post

Link to post
Share on other sites

I believe I forgot to mention that you can pass parameters to the function. It supports an (almost, there is a limit to string length :lmao:) unlimited amount of parameters for the function to be called. It does not support ByRef parameters (yet, I just thought of one way to do this :think:). I'll add some stuff to my post :)


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