You would use one of these in your script:
Code:
Check, MenuItemName: Adds a visible checkmark in the menu next to MenuItemName (if there isn't one already).
Uncheck, MenuItemName: Removes the checkmark (if there is one) from MenuItemName.
ToggleCheck, MenuItemName: Adds a checkmark if there wasn't one; otherwise, removes it.
Say you have:
Code:
Menu, Tray, Add, Item1, label1
Menu, Tray, Add, Item2, label2
Menu, Tray, Add, Item3, label3
Menu, Tray, Add, Item4, label4
So if USER clicks on Item1 it will take him/her to "label1:"
And in "label1:" you would have:
Code:
label1:
Menu, Tray, ToggleCheck, Item1
;more code here to do whatever
You can even base the toggle/& code on which item is clicked and have all of them going to the same Label:
Code:
Menu, Tray, ToggleCheck, %A_ThisMenuItem%
; more code, using either %A_ThisMenuItem% OR %A_ThisMenuItemPos%
Check out the DOCS for all the stuff you can do with the tray menu!
DBM