Kiti Posted June 14, 2008 Share Posted June 14, 2008 (edited) I've got this script from the Helpfiles, and I've modified it a little bit:#Include <Constants.au3> #NoTrayIcon Opt("TrayMenuMode",1) $display = TrayCreateItem("Display") TrayCreateItem("") $exit = TrayCreateItem("Exit") TraySetState() While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $display GUISetState(@SW_SHOW) Case $msg = $exit ExitLoop EndSelect WEnd ExitWhen I ran that script, everything was fine, the tray icon was there, so did the menu. But, when I've added it to my script, this customized menu wasn't there, but, instead, it was the normal Pause Script/Exit menu. I've put the above code both to the end and to the beggining of my script... no luck. What can I do about it? And, why it's #NoTrayItem in the helpfile, if we actually want a customized tray?And the last thing I want is, when i minimize the script, it shouldn't appear on the taskbar, and it should be displayed again with the above code. Is this possible? Thanks!Edit: Ok, now I understood that for the Display button to work properly, the function would have to be something like _WinMaximize, and not GUISetState(@SW_SHOW). Does anybody know what's the function called?Edit2: Hmm... Maybe, the top right "x" should make the GUI "rest" on the tray, using Case $GUI_EVENT_CLOSE, but how? Edited June 14, 2008 by Kiti Think outside the box.My Cool Lego Technic Website -- see walking bipeds and much more!My YouTube account -- see cool physics experimentsMy scripts:Minesweeper bot: Solves advanced level in 1 second (no registry edit), very improved GUI, 4 solving stylesCan't go to the toilet because of your kids closing your unsaved important work? - Make a specific window uncloseableCock Shooter Bot -- 30 headshots out of 30 Link to comment Share on other sites More sharing options...
newbiescripter Posted June 14, 2008 Share Posted June 14, 2008 I would use the tray as the main of your script. then put the script with your GUI in a function and call it when the display in the tray it being hit. Regards Link to comment Share on other sites More sharing options...
Kiti Posted June 14, 2008 Author Share Posted June 14, 2008 (edited) I would use the tray as the main of your script. then put the script with your GUI in a function and call it when the display in the tray it being hit.RegardsBrilliant!!! Thank you!And now, how can I close the function? I've tried "Exit _function()" but each time I exit another instance of the GUI appears. Sorry for the newbie questions Edit: I've tried WinKill but no luck...Edit2: Hmm... Maybe it can be done using GuiSetState(@SW_HIDE) and GUISetState(@SW_SHOW). Let me think a little bit.... Edited June 14, 2008 by Kiti Think outside the box.My Cool Lego Technic Website -- see walking bipeds and much more!My YouTube account -- see cool physics experimentsMy scripts:Minesweeper bot: Solves advanced level in 1 second (no registry edit), very improved GUI, 4 solving stylesCan't go to the toilet because of your kids closing your unsaved important work? - Make a specific window uncloseableCock Shooter Bot -- 30 headshots out of 30 Link to comment Share on other sites More sharing options...
Kiti Posted June 14, 2008 Author Share Posted June 14, 2008 Ok... I'm stuck. Some help would be appreaciated:) Think outside the box.My Cool Lego Technic Website -- see walking bipeds and much more!My YouTube account -- see cool physics experimentsMy scripts:Minesweeper bot: Solves advanced level in 1 second (no registry edit), very improved GUI, 4 solving stylesCan't go to the toilet because of your kids closing your unsaved important work? - Make a specific window uncloseableCock Shooter Bot -- 30 headshots out of 30 Link to comment Share on other sites More sharing options...
Kiti Posted June 14, 2008 Author Share Posted June 14, 2008 (edited) expandcollapse popup#include <ExcelCOM_UDF.au3> #include <GUIConstantsEx.au3> Local $oExcel = _ExcelBookNew(1) For $K = 1 To 25 _ExcelWriteCell($oExcel, "Step 1", $K, 1) Next #Include <Constants.au3> #NoTrayIcon Opt("TrayMenuMode",1) $display = TrayCreateItem("Display") TrayCreateItem("") $exit = TrayCreateItem("Exit") TraySetState() While 1 $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $display _show() Case $msg = $exit ExitLoop EndSelect WEnd Func _show() Local $YesID, $ExitID, $msg $gui = GUICreate("Custom Msgbox", 210, 80) GUICtrlCreateLabel("Please click a button!", 10, 10) $YesID = GUICtrlCreateButton("Validate!", 25, 40, 100, 30) $ExitID = GUICtrlCreateButton("Exit", 150, 50, 50, 20) GUISetState(@SW_SHOW); display the GUI $Note_win = WinGetHandle("Custom Msgbox", "") WinMove($Note_win, "", 700, 10) WinSetOnTop("Custom Msgbox", "", 1) While 1 $msg = GUIGetMsg() Switch $msg Case $YesID WinActivate("[CLASS:XLMAIN]", "") Send("{DOWN}"); fixes a bug: if you write "x" on a cell, and you don't select another cell, the GUI exits. $Cell = _ExcelFindInRange($oExcel, 'x', 1, 2, 25, 2, 0, 2, False, False) For $i = 1 To $Cell[0][0] $Step = _ExcelReadCell($oExcel, $Cell[$i][3], $Cell[$i][2] - 1) $level = StringTrimLeft($Step, 5) $nextlevel = $level + 1 _ExcelWriteCell($oExcel, "Step " & $nextlevel, $Cell[$i][3], $Cell[$i][2] - 1) Next _ExcelReplaceInRange($oExcel, "x", "", 1, 2, 25, 2, 2, False, "", False) Case $ExitID GuISetState(@SW_Hide) Case $GUI_EVENT_CLOSE GuISetState(@SW_Hide) EndSwitch WEnd Endfunc Exit Why it's not working? What's wrong? I can show, and then hide, but just once. Please someone help me! Edited June 14, 2008 by Kiti Think outside the box.My Cool Lego Technic Website -- see walking bipeds and much more!My YouTube account -- see cool physics experimentsMy scripts:Minesweeper bot: Solves advanced level in 1 second (no registry edit), very improved GUI, 4 solving stylesCan't go to the toilet because of your kids closing your unsaved important work? - Make a specific window uncloseableCock Shooter Bot -- 30 headshots out of 30 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now