Jump to content

Recommended Posts

Posted

Is it possible to addon/change the choices in the autoit tray icon so that if you hide a window, clicking on the tray icon will bring it back up?

TrayCreateMenu()

TrayCreateItem()

Posted

am i doning somethign wrong?

$restore = TrayCreateItem("Restore")

$msg = GUIGetMsg()
Switch $msg
Case $restore
  GUISetState(@SW_SHOW, $MainWindow)
EndSwitch
yeah, look at "TrayGetMsg" too :)

While 1
$msg = TrayGetMsg()
Switch $msg
Case $restore
  GUISetState(@SW_SHOW, $MainWindow)
EndSwitch
WEnd
Posted

Here is a POC i made for somebody else,

#include <GUIConstants.au3>
Opt("TrayAutoPause",0)
Opt("TrayMenuMode",1)

$GUI = GuiCreate("Test", 200,100)
$Menu = TrayCreateMenu("Display")
$Hide = TrayCreateItem("Hide", $menu)
$Show = TrayCreateItem("Show", $menu)
$Exit = TrayCreateItem("Exit")
GUISetState()

While 1
    $gMsg=GUIGetMsg()
    $tMsg=TrayGetMsg()
    Switch $gmsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $GUI_EVENT_MINIMIZE
            WinSetState($GUI,"",@SW_HIDE)
    EndSwitch
    Switch $tmsg
        Case $Hide
            WinSetState($GUI,"",@SW_HIDE)
        Case $Show
            WinSetState($GUI,"",@SW_Show)
            WinSetState($GUI,"",@SW_RESTORE)
        Case $Exit
            Exit
    EndSwitch
WEnd
Posted

Ok this is the last question i swear :)

My delete function:

Case $delete3
        $delete2 = GUICtrlRead($delete2)
        If $delete2 > 10 Then
            MsgBox(0, "Error", "Invalid number.")
        Else
        IniDelete(@ScriptDir & "\config.ini", $delete2)
        $f = 1
        For $i = 1 To 10 Step 1
            $n = IniRenameSection(@ScriptDir & "\config.ini", $i, $f)
            If $n <> 0 Then
                $f += 1
            EndIf
            MsgBox(0, "", $i & " " & $f & " " & $n)
        Next

I know its a little messy but fot the most part it works.

Basically when a Section is deleted from the INI (names are 1, 2, 3... up to 10) they need to be renamed in order for the GUI to operate the next time. So if a user deletes 3 it starts at 1 and renames to 1 until it gets to 4(3 is skiped) and 4 should be renamed to 3, 5 to 4... This is whats not working. From what i read about IniRenameSection() it fails if the new value is one that already exists(And it checks this before changing it so when its trying to rename 1 back to 1 it fails and stops). Any way around this?

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
×
×
  • Create New...