Jump to content

Minimize to Tray


Recommended Posts

I did a search for this and i found a few topics but i dont think that they are doing what i want or if i can even somehow implement them into my script.

Script:

Global $folder = True
#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

$folder = FileSelectFolder("Select the folder containg you OGame scripts.","")

MsgBox(0,"Dont Fuck Up!","This script depends on your scripts being named properly. Please make sure the scripts contain the following names!! They ARE CASE-SENSITIVE" & @CRLF & "" & @CRLF & "DF Watcher = DF Watcher v1.3.exe" & @CRLF & "Quickstart DF Watcher = DF Watcher 3.0 Quickstart.exe" & @CRLF & "Idler = Idler v1.2.exe" & @CRLF & "Anti - Idle (Under Construction)= AntiIdler.exe" & @CRLF & "Building Queue (Under Construction)= BuildingQueue.exe" & @CRLF & "Fleetsaver (Under Construction)= Fleetsaver.exe")

Toolkit()

Func Toolkit()
    Local $Button_1, $Button_2, $Button_3, $Button_4, $Button_5, $Button_6, $Button_7, $Button_8,$Button_9,$Button_10, $Button_11, $msg
    GUICreate("OGame Tool Kit",210,180)

    GUICtrlCreateLabel ("Select Script:", 7.5, 10)
    Opt("GUICoordMode", 2)
    $Button_1 = GUICtrlCreateButton("DF Watcher", -1, 10, 100)
    $Button_2 = GUICtrlCreateButton("DF Watcher - QS", 0, -1)
    $Button_3 = GUICtrlCreateButton("Building Queue", -200, 0)
    $Button_4 = GUICtrlCreateButton("Fleetsaver", 0, -1)
    $Button_5 = GUICtrlCreateButton("TBA", -200, 0)
    $Button_6 = GUICtrlCreateButton("TBA", 0,-1)
    $Button_7 = GUICtrlCreateButton("TBA", -200, 0)
    $Button_8 = GUICtrlCreateButton("TBA", 0, -1)
    $Button_9 = GUICtrlCreateButton("TBA", -200, 0)
    $Button_10 = GUICtrlCreateButton("TBA", 0, -1)
    $Button_11 = GUICtrlCreateButton("Minimize to Tray",-150,0,100)


    GUISetState()

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button_1
                Run("" & $folder & "\DF Watcher v1.2.exe")
            Case $msg = $Button_2
                Run("" & $folder & "\DF Watcher 3.0 Quickstart.exe")
            Case $msg = $Button_3
                Run("" & $folder & "\Idler v1.2.exe")
            Case $msg = $Button_4
            ;Run("" & $folder & "\AntiIdle.exe")
                MsgBox(0,"Sorry!","This script is still under construction")
            Case $msg = $Button_5
            ;Run("" & $folder & "\Fleetsaver.exe")
                MsgBox(0,"Sorry!","This script is still under construction")
            Case $msg = $Button_6
            ;Run("" & $folder & "\BuldingQueue.exe")
                MsgBox(0,"Sorry!","This script is still under construction")
            Case $msg = $Button_7
                MsgBox(0,"Sorry!","No function exists")
            Case $msg = $Button_8
                MsgBox(0,"Sorry!","No function exists")
            Case $msg = $Button_9
                MsgBox(0,"Sorry!","No function exists")
            Case $msg = $Button_10
                MsgBox(0,"Sorry!","No function exists")
            Case $msg = $Button_11
                pause()
        EndSelect
    WEnd
EndFunc

basically what i want to do, is if the user hits button 11 which is "minimize to tray," i want the box with the buttons to minimize to the tray as opposed to just minimizing.

how exactly can i do this? also...if i can...i want to make the actual minimize button do the same thing.

if i do end up getting this to work...can the user just click the tray icon to bring it back up or must i hotkey something in order to do that?

Link to comment
Share on other sites

Case $msg = $Button_11
                GUISetState(@SW_HIDE)

disable tray click to pause:

Opt("TrayAutoPause",0)

Once your script is "minimized", poll the tray for events:

$msg = TrayGetMsg()
        Select
            Case $msg = $TRAY_EVENT_PRIMARYDOWN
                   GUISetState(@SW_SHOW)
          EndSelect
Edited by TurionAltec
Link to comment
Share on other sites

Case $msg = $Button_11
                GUISetState(@SW_HIDE)

disable tray click to pause:

Opt("TrayAutoPause",0)

Once your script is "minimized", poll the tray for events:

$msg = TrayGetMsg()
        Select
            Case $msg = $TRAY_EVENT_PRIMARYDOWN
                   GUISetState(@SW_SHOW)
          EndSelect

im not seeing where in my script i have to put all this? :S

Link to comment
Share on other sites

  • Moderators

I did a search for this and i found a few topics but i dont think that they are doing what i want or if i can even somehow implement them into my script.

thanks for being a smart you know what.

i figured it out anyway so you can close this since you feel all ba about being a jerk :)

I was merely pointing you to specific topics on what you're asking for.

I don't much feel like closing the topic, but if you'd like to continue, I can help you figure out how to never post to the forum again... hows that sound?

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

I was merely pointing you to specific topics on what you're asking for.

I don't much feel like closing the topic, but if you'd like to continue, I can help you figure out how to never post to the forum again... hows that sound?

well i thank you for that and do as you wish but i had already read most of those topics (all that relate to minimizing to the tray at least) and none of them helped. i spent almost an entire day yesterday trying to find something that worked. when i say that i have searched i mean it. i look everywhere. these forums, online, wiki...

if what i find cant help me then i post here.

so basically all i was saying is that, i had already mentioned that i had searched and it was basically so i didnt get someone coming in here who links me to a search.

but i guess that didnt work.

thanks for the help anyway tho, and i am sorry that i apparently got to offensive.

Link to comment
Share on other sites

  • Moderators

well i thank you for that and do as you wish but i had already read most of those topics (all that relate to minimizing to the tray at least) and none of them helped. i spent almost an entire day yesterday trying to find something that worked. when i say that i have searched i mean it. i look everywhere. these forums, online, wiki...

if what i find cant help me then i post here.

so basically all i was saying is that, i had already mentioned that i had searched and it was basically so i didnt get someone coming in here who links me to a search.

but i guess that didnt work.

thanks for the help anyway tho, and i am sorry that i apparently got to offensive.

Well you've found a solution ... that's good.

Personally, if you can understand wraithdu's example here... I like this one: http://www.autoitscript.com/forum/index.ph...st&p=615641

On my machine, I had to change "ToolbarWindow324" to "ToolbarWindow323", but he shows in the example that it's more than likely "ToolbarWindow322" (That's the base start, If you have Desktop toolbar up, or others you'll have to enum through until you get the right number) for xp machines.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Global $folder = True
#include <GUIConstantsEx.au3>
#Include <Constants.au3>

Opt('MustDeclareVars', 1)
Opt("TrayAutoPause",0)
Opt("TrayMenuMode",1)

$folder = FileSelectFolder("Select the folder containg you OGame scripts.","")

MsgBox(0,"Dont Fuck Up!","This script depends on your scripts being named properly. Please make sure the scripts contain the following names!! They ARE CASE-SENSITIVE" & @CRLF & "" & @CRLF & "DF Watcher = DF Watcher v1.3.exe" & @CRLF & "Quickstart DF Watcher = DF Watcher 3.0 Quickstart.exe" & @CRLF & "Idler = Idler v1.2.exe" & @CRLF & "Anti - Idle (Under Construction)= AntiIdler.exe" & @CRLF & "Building Queue (Under Construction)= BuildingQueue.exe" & @CRLF & "Fleetsaver (Under Construction)= Fleetsaver.exe")

Toolkit()

Func Toolkit()
    Local $Button_1, $Button_2, $Button_3, $Button_4, $Button_5, $Button_6, $Button_7, $Button_8,$Button_9,$Button_10, $Button_11, $msg
    GUICreate("OGame Tool Kit",210,180)

    GUICtrlCreateLabel ("Select Script:", 7.5, 10)
    Opt("GUICoordMode", 2)
    $Button_1 = GUICtrlCreateButton("DF Watcher", -1, 10, 100)
    $Button_2 = GUICtrlCreateButton("DF Watcher - QS", 0, -1)
    $Button_3 = GUICtrlCreateButton("Building Queue", -200, 0)
    $Button_4 = GUICtrlCreateButton("Fleetsaver", 0, -1)
    $Button_5 = GUICtrlCreateButton("TBA", -200, 0)
    $Button_6 = GUICtrlCreateButton("TBA", 0,-1)
    $Button_7 = GUICtrlCreateButton("TBA", -200, 0)
    $Button_8 = GUICtrlCreateButton("TBA", 0, -1)
    $Button_9 = GUICtrlCreateButton("TBA", -200, 0)
    $Button_10 = GUICtrlCreateButton("TBA", 0, -1)
    $Button_11 = GUICtrlCreateButton("Minimize to Tray",-150,0,100)


    GUISetState()

    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $Button_1
                Run("" & $folder & "\DF Watcher v1.2.exe")
            Case $msg = $Button_2
                Run("" & $folder & "\DF Watcher 3.0 Quickstart.exe")
            Case $msg = $Button_3
                Run("" & $folder & "\Idler v1.2.exe")
            Case $msg = $Button_4
           ;Run("" & $folder & "\AntiIdle.exe")
                MsgBox(0,"Sorry!","This script is still under construction")
            Case $msg = $Button_5
           ;Run("" & $folder & "\Fleetsaver.exe")
                MsgBox(0,"Sorry!","This script is still under construction")
            Case $msg = $Button_6
           ;Run("" & $folder & "\BuldingQueue.exe")
                MsgBox(0,"Sorry!","This script is still under construction")
            Case $msg = $Button_7
                MsgBox(0,"Sorry!","No function exists")
            Case $msg = $Button_8
                MsgBox(0,"Sorry!","No function exists")
            Case $msg = $Button_9
                MsgBox(0,"Sorry!","No function exists")
            Case $msg = $Button_10
                MsgBox(0,"Sorry!","No function exists")
            Case $msg = $Button_11
               GUISetState(@SW_HIDE)
        EndSelect

     $msg = TrayGetMsg()
        Select
            Case $msg = $TRAY_EVENT_PRIMARYDOWN
                   GUISetState(@SW_SHOW)
         EndSelect

    WEnd
EndFunc

I added an extra include at the top, and added a couple opt()s as well.

Alternatively instead of having a dedicated minimize to tray icon, you can do it by default with the standard minimize button by responding to:

$GUI_EVENT_MINIMIZE

Link to comment
Share on other sites

  • 3 weeks later...

don't know if you got it solved..

I've done the minimize to tray some times..

This example is when the gui IS minimized, and hidden into a tray icon!

$gui = guicreate("Gui")

guisetstate()


while 1
$tgm = traygetmsg()
select
case $tgm = $TRAY_EVENT_PRIMARYDOWN
        winsetstate($gui, "", @sw_show)
        winsetstate($gui, "", @sw_restore)
        opt("TrayIconHide", 1)
endselect
wend
Link to comment
Share on other sites

#NoTrayIcon

#Include <Constants.au3>
#Include <GUIConstantsEx.au3>

Opt('TrayMenuMode', 1)

$TrayRestoreItem = TrayCreateItem('Restore')
TrayItemSetState(-1, $TRAY_DEFAULT)
TrayCreateItem('')
$TrayExitItem = TrayCreateItem('Exit')
TraySetClick(8)

$Form = GUICreate('My GUI')
GUISetState()

While 1
    $TrayMsg = TrayGetMsg()
    Switch $TrayMsg
        Case $TrayRestoreItem
            GUISetState(@SW_SHOW, $Form)
            GUISetState(@SW_RESTORE, $Form)
            TraySetState(2)
        Case $TrayExitItem
            ExitLoop
    EndSwitch
    $GUIMsg = GUIGetMsg()
    Switch $GUIMsg
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $GUI_EVENT_MINIMIZE
            GUISetState(@SW_HIDE, $Form)
            TraySetState(1)
    EndSwitch
WEnd

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