Jump to content

EasyTrayMenu


TK_Incorperate
 Share

Recommended Posts

I've found the help menu isnt as user friendly as people would think, alot of people just learning probably couldnt understand so i thought i'd make tray icon menus a little more understandable

First off you'll need to add this line, i found that the 2 top lines in the readme are pretty much useless but this one is needed

Opt("TrayMenuMode",1)

Then you'll need to create menus or items, i'll give you 2 exmaples here

Example 1: Menu

$menu1    = TrayCreateMenu("####")
$****item   = TrayCreateItem("####", $menu1)
$****item   = TrayCreateItem("####", $menu1)
$****item   = TrayCreateItem("####", $menu1)

Where there is #### you'll need to change to the name of the menu/menu item

Where there is **** you'll need to a shorter version of the name, example if your menu item is About it would look something like this

$menu1    = TrayCreateMenu("About")
$atritem    = TrayCreateItem("Auther", $menu1)
$vsnitem    = TrayCreateItem("Version", $menu1)
$infitem    = TrayCreateItem("Info", $menu1)

You can add as many or as little of these menus as possible, but afterwards you ALWAYS want to set an exit button to exit the script

$exititem      = TrayCreateItem("Exit")

Now we need to add a couple more lines in before we start editing the menus

TraySetState()

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop

And now we can start editing the menus and menu items, i personaly like to use popup windows to explain the script, ill explain this

Case $msg = $atritem;This is where you set witch menu item links to this window
            Msgbox(64,"Info:","Auther: TK_Incorperate - TK_Incorperate@yahoo.com")

Where it says "Info:", edit that to change the header of your window

You'll compile these one after another to make the full menu and it should look something like this

Case $msg = $atritem
            Msgbox(64,"Info:","Auther: TK_Incorperate - TK_Incorperate@yahoo.com")
        Case $msg = $vsnitem 
            Msgbox(64,"Info:","Version: 1.0 Pub release")
        Case $msg = $infitem
            Msgbox(64,"Info:","About: Tray menu for AutoIt scripts made easy")

After this we need to add the Exit commant and link it to the one above and finish the menu off

Case $msg = $exititem
            ExitLoop
    EndSelect
WEnd
Exit

Now that should be it and your finished script should look something like this....

Opt("TrayMenuMode",1)

$menu1    = TrayCreateMenu("About")
$atritem    = TrayCreateItem("Auther", $menu1)
$vsnitem    = TrayCreateItem("Version", $menu1)
$infitem    = TrayCreateItem("Info", $menu1)
$exititem      = TrayCreateItem("Exit")

TraySetState()

While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = 0
            ContinueLoop
        Case $msg = $atritem
            Msgbox(64,"Info:","Auther: TK_Incorperate - TK_Incorperate@yahoo.com")
        Case $msg = $vsnitem 
            Msgbox(64,"Info:","Version: 1.0 Pub release")
        Case $msg = $infitem
            Msgbox(64,"Info:","About: Tray menu for AutoIt scripts made easy")
        Case $msg = $exititem
            ExitLoop
    EndSelect
WEnd
Exit

I dont have too much patients so i'll post example 2 to finish later, but that should do you good for menus and popup windows

Edited by TK_Incorperate
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...