Jump to content
Sign in to follow this  
Vladi243

Exit from tray menu

Recommended Posts

Vladi243

I created tray menu with exit, but it doesn't exit the script when I click on it. I wrote it exactly as in the help file. Here is my all script. Please help...

#include <GUIConstants.au3>
#include <IE.au3>
#NoTrayIcon

Opt("TrayMenuMode",1)   ; Default tray menu items (Script Paused/Exit) will not be shown.
TrayCreateItem("")
$AboutItem = TrayCreateItem("About")
TrayCreateItem("")
$ExitItem = TrayCreateItem("Exit")
TraySetState()

_IEErrorHandlerRegister ()

Global $oIE1 = _IECreateEmbedded ()
Global $oIE2 = _IECreateEmbedded ()
Global $Browser, $First_Group, $GUIActiveX1, $First_Link_Label, $First_Link_Input, $Surf1_Button, $Second_Group, $GUIActiveX2, _
$Input1, $Label1, $Surf2_Button, $Hide, $Minimize_To_Tray, $GUICtrlReadFirstLink, $GUICtrlReadSecondLink

#Region ### START Koda GUI section ### Form=D:\Vladik\Autoit\koda_1.7.0.1\Forms\Browser.kxf
$Browser = GUICreate("Browser", 651, 483, 186, 146)
$First_Group = GUICtrlCreateGroup("First Surf Page", 8, 10, 633, 210)
$GUIActiveX1 = GUICtrlCreateObj($oIE1, 25, 50, 600, 160)
$First_Link_Label = GUICtrlCreateLabel("Link", 24, 28, 28, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$First_Link_Input = GUICtrlCreateInput("", 56, 26, 488, 21)
$Surf1_Button = GUICtrlCreateButton("Surf", 554, 26, 80, 21, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Second_Group = GUICtrlCreateGroup("Second Surf Page", 8, 230, 633, 210)
$GUIActiveX2 = GUICtrlCreateObj($oIE2, 25, 270, 600, 160)
$Second_Link_Input = GUICtrlCreateInput("", 56, 246, 488, 21)
$Label1 = GUICtrlCreateLabel("Link", 24, 248, 28, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Surf2_Button = GUICtrlCreateButton("Surf", 554, 246, 80, 21, 0)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Hide = GUICtrlCreateButton("Hide the browser", 540, 450, 102, 25, 0)
$Minimize_To_Tray = GUICtrlCreateButton("Minimize to tray", 420, 450, 102, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

HotKeySet ("{F5}", "ShowGUI")

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Surf1_Button
            $GUICtrlReadFirstLink = GUICtrlRead ($First_Link_Input)
            _IENavigate ($oIE1, $GUICtrlReadFirstLink)
        Case $msg = $Surf2_Button
            $GUICtrlReadSecondLink = GUICtrlRead ($Second_Link_Input)            
            _IENavigate ($oIE2, $GUICtrlReadSecondLink)
        Case $msg = $Hide
            GUISetState(@SW_MINIMIZE)
            GUISetState(@SW_HIDE)
            TraySetState (2)
            MsgBox (1, "Hidden Browser", "Your Browser is hidden. Press F5 to show it again")
        Case $msg = $Minimize_To_Tray
            GUISetState(@SW_MINIMIZE)
            GUISetState(@SW_HIDE)
        Case $msg = $ExitItem
            ExitLoop
    EndSelect
WEnd

GUIDelete()
exit

;Shows the GUI from the tray/hidden mode.
Func ShowGUI()
    GUISetState(@SW_SHOW)
    GUISetState(@SW_RESTORE)
    TraySetState (1)
EndFunc

Share this post


Link to post
Share on other sites
PsaltyDS

I created tray menu with exit, but it doesn't exit the script when I click on it. I wrote it exactly as in the help file. Here is my all script. Please help...

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Surf1_Button
           ;...
    Case $msg = $ExitItem
        ExitLoop
    EndSelect
WEnd
GUI messages come from GuiGetMsg(), and Tray messages come from TrayGetMsg().

Tell me again how you wrote it exactly as in the help file...

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Vladi243

Thanks:) I didn't notice that :)

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  

×