blckpythn Posted September 12, 2012 Posted September 12, 2012 (edited) Hello,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") ;; TraySetState(1) ; Check if Self Help menu should be enabled for this user/domain. SelfHelp() ; Continue to run trayicon until exited via ExitFunc. While 1 Sleep(900000) WEnd ;----------Functions----------; ; Create SelfHelp Menu if part of an applicable Domain Func SelfHelp() ConsoleWrite(@LogonDomain & @CRLF) Switch @LogonDomain Case "TULSACF.LOCAL", "BBBSOK.LOCAL", "INTERNAL.TWCC.CEN" Global $SelfHelp = TrayCreateMenu("Self Help", Default, 5) $MapDrives = TrayCreateItem("Re-Map Drives", $SelfHelp) TrayItemSetOnEvent($MapDrives, "MapDrives") EndSwitch EndFunc ;==>SelfHelpEDIT: SHOULD HAVE USED @LOGONDNSDOMAIN Edited September 12, 2012 by blckpythn
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now