sebsabul 0 Posted April 5, 2005 Hey guys, need some help! Why don´t run the item: exit? (or the function myevent2())? What did I worog with the command GUICtrlSetOnEvent?? Here is my script: #include <GUIConstants.au3> #Include <Constants.au3> #include <GUIConstants.au3> #Include <Constants.au3> #NoTrayIcon Opt("TrayMenuMode",1) Opt("GUIOnEventMode", 1) $trayitem1 = TrayCreateItem("Anzeigen") TraySetItemState($trayitem1, $TRAY_DEFAULT);just need to click the tray icon to select item $starten = TrayCreateItem("Nachrichtendienst starten") $beenden = TrayCreateItem("Nachrichtendienst beenden") $exititem = TrayCreateItem("Exit") TraySetClick(8); only show tray menu on right-click $InfoGui = GUICreate("Info", 900, 500) $textlabel = GUICtrlCreateLabel ("", 5, 5, 895, 150) $textlabel2 = GUICtrlCreateLabel ("", 5, 170, 895, 150) $textlabel3 = GUICtrlCreateLabel ("", 5, 340, 895, 150) GUISetState (@SW_SHOW) AdlibEnable("myadlib", 1000) GUISetOnEvent ( $GUI_EVENT_CLOSE, "myevent") GUICtrlSetOnEvent ( $starten, "myevent2") local $info = 0 local $wait = 1000 local $timer = 0 TraySetIcon("Shell32.dll",130) While 1 WinWait("Nachrichtendienst", "") If WinWait("Nachrichtendienst", "") then $info = $info + 1 $text = WinGetText("Nachrichtendienst") ControlSetText($InfoGui, "", $textlabel, $text) TrayTip ( "Info", "Meldung eingegangen", 86400000) winclose("Nachrichtendienst") endif If $info = 10 then Run("C:\Windows\System\meldung.bat") sleep(2000) Run("net stop nachrichtendienst") TrayTip ( "Info", "Nachrichtendienst beendet", 86400000) $info = 0 endif WinWait("Nachrichtendienst", "") If WinWait("Nachrichtendienst", "") then $info = $info + 1 $text = WinGetText("Nachrichtendienst") ControlSetText($InfoGui, "", $textlabel2, $text) TrayTip ( "Info", "Meldung eingegangen", 86400000) winclose("Nachrichtendienst") endif If $info = 10 then Run("C:\Windows\System\meldung.bat") sleep(2000) Run("net stop nachrichtendienst") TrayTip ( "Info", "Nachrichtendienst beendet", 86400000) $info = 0 endif WinWait("Nachrichtendienst", "") If WinWait("Nachrichtendienst", "") then $info = $info + 1 $text = WinGetText("Nachrichtendienst") ControlSetText($InfoGui, "", $textlabel3, $text) TrayTip ( "Info", "Meldung eingegangen", 86400000) winclose("Nachrichtendienst") endif If $info = 10 then Run("C:\Windows\System\meldung.bat") sleep(2000) Run("net stop nachrichtendienst") TrayTip ( "Info", "Nachrichtendienst beendet", 86400000) $info = 0 endif Wend Func myadlib() $timer = $timer + 1 If $timer = 60 Then $info = 0 If $timer = 60 then $timer = 0 EndFunc Func myevent() exit EndFunc Func myevent2() Runwait("net start nachrichtendienst") EndFunc Thank you for help. Share this post Link to post Share on other sites
buzz44 1 Posted April 5, 2005 (edited) Your missing the file extension. The name of the executable (EXE, BAT, COM, PIF) to run. eg. Runwait("net start nachrichtendienst.exe") Edited April 5, 2005 by burrup qq Share this post Link to post Share on other sites
jpm 93 Posted April 5, 2005 I don't think tray functions can have onevent functions. Holger will confirm Basically they don't use GuiGetMsg but TrayGetMsg The return of GUICtrlSetOnEvent ( $starten, "myevent2") is 0 which means no success Share this post Link to post Share on other sites
sebsabul 0 Posted April 5, 2005 (edited) mhmm and what can i do now? is there any solution? thank you for help.. Edited April 5, 2005 by sebsabul Share this post Link to post Share on other sites
CyberSlug 6 Posted April 5, 2005 Actually there is Opt("TrayOnEventMode", 1) I'm not 100% sure how to use it, though. Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Share this post Link to post Share on other sites
sebsabul 0 Posted April 5, 2005 yeah thanks, there is a option called Opt("TrayOnEventMode", 1) .. anybody knows how to use it (with my script) generally.. thanks.. Share this post Link to post Share on other sites
CyberSlug 6 Posted April 5, 2005 Ah#60626(Missing from help file)So you need something like:Opt("TrayOnEventMode", 1);.......TraySetItemOnEvent($exititem, "myevent") Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Share this post Link to post Share on other sites
sebsabul 0 Posted April 5, 2005 It works fine thank you very much ! ! ! ! T H A N K S ! ! ! Share this post Link to post Share on other sites