Jump to content

How to put an autoit script in the system tray?


Recommended Posts

; tray menu options below
Opt("TrayMenuMode", 1)
Opt("TrayOnEventMode", 1)
$abttray = TrayCreateItem("About Your Program")
TrayItemSetOnEvent($abttray, "_abt")
TrayCreateItem("")
$resttray = TrayCreateItem("Show")
TrayItemSetOnEvent($resttray, "_restoregui")
TrayCreateItem("")
$exittray = TrayCreateItem("Exit")
TrayItemSetOnEvent($exittray, "_exitgui")
TraySetState()
TraySetToolTip("Name of Your Program")

Func _abt()
    SoundPlay($Sound_grp)
    $iMsgBoxAnswer = MsgBox(32, "Your About Message", 20)
    Select
        Case $iMsgBoxAnswer = -1 
    EndSelect
EndFunc   

Func _exitgui()
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $NameOfYourGUIVariable, "int", 500, "long", 0x00090000)
    Exit
EndFunc   ;==>_exitgui

Func _restoregui()
    GUISetState(@SW_RESTORE, $NameOfYourGUIVariable)
EndFunc   ;==>_restoregui

My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic]

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...