sebsabul Posted April 5, 2005 Share 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. Link to comment Share on other sites More sharing options...
buzz44 Posted April 5, 2005 Share 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 Link to comment Share on other sites More sharing options...
jpm Posted April 5, 2005 Share 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 Link to comment Share on other sites More sharing options...
sebsabul Posted April 5, 2005 Author Share 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 Link to comment Share on other sites More sharing options...
CyberSlug Posted April 5, 2005 Share 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! Link to comment Share on other sites More sharing options...
sebsabul Posted April 5, 2005 Author Share 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.. Link to comment Share on other sites More sharing options...
CyberSlug Posted April 5, 2005 Share 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! Link to comment Share on other sites More sharing options...
sebsabul Posted April 5, 2005 Author Share Posted April 5, 2005 It works fine thank you very much ! ! ! ! T H A N K S ! ! ! 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