Jump to content
Sign in to follow this  
narciso

Modification of Tray Icon Behavior

Recommended Posts

narciso

Hello,

Is it possible to change the behavior of a compiled script Tray Icon such that upon clicking it, it does not show any menu but performs a predefined function, like e.g. exiting the program?

Edited by narciso

Warmly,Narciso

Share this post


Link to post
Share on other sites
Xenobiologist

Hello,

Is it possible to change the behavior of a compiled script Tray Icon such that upon clicking it, it does not show any menu but performs a predefined function, like e.g. exiting the program?

Hi,

yes it is. TrayMenuMode

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
narciso

Hi,

yes it is. TrayMenuMode

So long,

Mega

Would you please give an example? I suspect you mean TrayMenuMode 2, but I cannot figure out how to use it. Let's asume I want the script to Exit if the user has clicked (left or right mouse button) on the Trai Icon.

Warmly,Narciso

Share this post


Link to post
Share on other sites
Xenobiologist

HI,

#Include <Constants.au3>
Opt("TrayMenuMode", 1)   ; Default tray menu items (Script Paused/Exit) will not be shown.
TraySetState()

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = $TRAY_EVENT_PRIMARYDOWN
            MsgBox(0, "$TRAY_EVENT_PRIMARYDOWN", "EXIT", 2)
            Exit (0)
        Case $msg = $TRAY_EVENT_SECONDARYDOWN
            MsgBox(0, "$TRAY_EVENT_SECONDARYDOWN", "EXIT", 2)
            Exit (0)
    EndSelect
WEnd

Exit

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
narciso

HI,

#Include <Constants.au3>
Opt("TrayMenuMode", 1)   ; Default tray menu items (Script Paused/Exit) will not be shown.
TraySetState()

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = $TRAY_EVENT_PRIMARYDOWN
            MsgBox(0, "$TRAY_EVENT_PRIMARYDOWN", "EXIT", 2)
            Exit (0)
        Case $msg = $TRAY_EVENT_SECONDARYDOWN
            MsgBox(0, "$TRAY_EVENT_SECONDARYDOWN", "EXIT", 2)
            Exit (0)
    EndSelect
WEnd

Exit

So long,

Mega

Thx :)

Warmly,Narciso

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  

×