Jump to content
Sign in to follow this  

Creating TrayMenus within a Function [Self-Resolved]

Recommended Posts


I am trying to find a way to create a tray menu then call a function that decides whether or not more traymenus or trayitems should be added.

Unfortunately it appears as though it can't find the traymenu outside of the function.

Here is a snippet of where the problem lies.

Note that I am still testing the method and will be adding more Switch Cases.

I have already tested with an If/Else statement instead of Switch/Case with no improvement in results.

Global $RemoteAccess = TrayCreateItem("Remote Access", Default, 4)
TrayItemSetOnEvent($RemoteAccess, "RemoteAccess")
Global $Diagnostics = TrayCreateMenu("Diagnostics", Default, 6)
Global $gpupdate = TrayCreateItem("Update Group Policy", $Diagnostics, Default, 7)
TrayItemSetOnEvent($gpupdate, "GPupdate")
Global $Reporting = TrayCreateItem("Reporting", $Diagnostics, Default, 8)
TrayItemSetOnEvent($Reporting, "SysInfo")
Global $exititem = TrayCreateItem("Exit", Default, 9)
TrayItemSetOnEvent($exititem, "ExitFunc")

; Check if Self Help menu should be enabled for this user/domain.

; Continue to run trayicon until exited via ExitFunc.
While 1

; Create SelfHelp Menu if part of an applicable Domain
Func SelfHelp()
ConsoleWrite(@LogonDomain & @CRLF)
Switch @LogonDomain
Global $SelfHelp = TrayCreateMenu("Self Help", Default, 5)
$MapDrives = TrayCreateItem("Re-Map Drives", $SelfHelp)
TrayItemSetOnEvent($MapDrives, "MapDrives")
EndFunc ;==>SelfHelp


Edited by blckpythn

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...