Nahuel 1 Posted September 19, 2007 Double click on the tray icon and it will create a new gui. Now, how do I make it possible to close each one of them individually? It'd be great if the number of Gui's isn't limited too. #include <Guiconstants.au3> #include <Constants.au3> Opt("TrayMenuMode",1) Opt("TrayAutoPause",0) TraySetClick (8) $NuevaNota=TrayCreateItem("New Gui") TrayCreateItem("") $salir = TrayCreateItem("Exit") while 1 Sleep(10) $msgT=TrayGetMsg() $msg=GuiGetMsg() Select Case $msgT=$salir Exit Case $msgT=$NuevaNota OR $msgT=$TRAY_EVENT_PRIMARYDOUBLE GUICreate("My Gui",200,200) GUISetState() WinSetTrans("My Gui","",170) EndSelect WEnd Share this post Link to post Share on other sites
enaiman 16 Posted September 19, 2007 Here is a solution: You have to identify somehow all your created GUI My example will close your active GUI (obviously - you can close the active window only) #include <Guiconstants.au3> #include <Constants.au3> Opt("TrayMenuMode",1) Opt("TrayAutoPause",0) TraySetClick (8) $NuevaNota=TrayCreateItem("New Gui") TrayCreateItem("") $salir = TrayCreateItem("Exit") Dim $count = 0 Dim $gui[100] while 1 Sleep(10) $msgT=TrayGetMsg() $msg=GuiGetMsg() Select Case $msgT=$salir Exit Case $msgT=$NuevaNota OR $msgT=$TRAY_EVENT_PRIMARYDOUBLE $count +=1 $gui[$count] = GUICreate("My Gui",200,200) GUISetState() WinSetTrans("My Gui","",170) Case $msg = $GUI_EVENT_CLOSE For $i=1 To $count If WinActive($gui[$i]) Then GUIDelete($gui[$i]) ExitLoop EndIf Next EndSelect WEnd SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example scriptwannabe "Unbeatable" Tic-Tac-ToePaper-Scissor-Rock ... try to beat it anyway :) Share this post Link to post Share on other sites
PsaltyDS 42 Posted September 20, 2007 (edited) Use the advanced mode of GuiGetMsg() to know which GUI it came from: #include <Guiconstants.au3> #include <Constants.au3> Opt("TrayMenuMode", 1) Opt("TrayAutoPause", 0) TraySetClick(8) Global $n = 0 $NuevaNota = TrayCreateItem("New Gui") TrayCreateItem("") $salir = TrayCreateItem("Exit") While 1 Sleep(10) $msgT = TrayGetMsg() $msg = GUIGetMsg(1) ; 1 = Advanced mode Select Case $msgT = $salir Exit Case $msgT = $NuevaNota Or $msgT = $TRAY_EVENT_PRIMARYDOUBLE $n += 1 $hGUI = GUICreate("My Gui " & $n, 200, 200, $n * 100, $n * 100) GUISetState(@SW_SHOW, $hGUI) WinSetTrans($hGUI, "", 170) Case $msg[0] = $GUI_EVENT_CLOSE GUIDelete($msg[1]) EndSelect WEnd Edited September 20, 2007 by PsaltyDS 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
Nahuel 1 Posted September 20, 2007 Use the advanced mode of GuiGetMsg() to know which GUI it came from: #include <Guiconstants.au3> #include <Constants.au3> Opt("TrayMenuMode", 1) Opt("TrayAutoPause", 0) TraySetClick(8) Global $n = 0 $NuevaNota = TrayCreateItem("New Gui") TrayCreateItem("") $salir = TrayCreateItem("Exit") While 1 Sleep(10) $msgT = TrayGetMsg() $msg = GUIGetMsg(1) ; 1 = Advanced mode Select Case $msgT = $salir Exit Case $msgT = $NuevaNota Or $msgT = $TRAY_EVENT_PRIMARYDOUBLE $n += 1 $hGUI = GUICreate("My Gui " & $n, 200, 200, $n * 100, $n * 100) GUISetState(@SW_SHOW, $hGUI) WinSetTrans($hGUI, "", 170) Case $msg[0] = $GUI_EVENT_CLOSE GUIDelete($msg[1]) EndSelect WEnd Brilliant! Thanks a lot, both of you! Share this post Link to post Share on other sites
Nahuel 1 Posted September 20, 2007 Is there a way to do this with GuiOnEventMode? :"> It's very complicated to deal with controls in the Gui's :"> Share this post Link to post Share on other sites
PsaltyDS 42 Posted September 20, 2007 Is there a way to do this with GuiOnEventMode? :"> It's very complicated to deal with controls in the Gui's :">Yes. Just set your GuiSetOnEvent() and GuiCtrlSetOnEvent() functions, and in those functions use @GUI_CtrlID, @GUI_CtrlHandle, and @GUI_WinHandle macros to identify the window and control that generated the event. 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
Nahuel 1 Posted September 20, 2007 Awesome. I got it working the other way though, haha. If it gets messy I'm definitely using this. Thanks! Share this post Link to post Share on other sites