sebsabul 0 Posted April 2, 2005 (edited) Hey guys, I´ve got a problem: Please help me: Questions: 1. When I click the trayicon " Anzeigen" the gui should be visible. How? 2. When the Gui is visible, the trayicon " Anzeigen" should change to "Verstecken". How? 3. And when I click the trayicon "Verstecken" the gui should be invisble. How? Here is my source: #include <GUIConstants.au3> #Include <Constants.au3> #NoTrayIcon Opt("TrayMenuMode",1) TraySetState() $trayitem1 = TrayCreateItem("Anzeigen") $exititem = TrayCreateItem("Exit") $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_HIDE) AdlibEnable("myadlib", 1000) AdlibEnable("myadlib2", 1) local $info = 0 local $wait = 1000 local $timer = 0 TraySetIcon("Shell32.dll",176) 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\send.massage.disabled.bat") sleep(2000) Run("net stop nachrichtendienst") $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\send.massage.disabled.bat") sleep(2000) Run("net stop nachrichtendienst") $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\send.massage.disabled.bat") sleep(2000) Run("net stop nachrichtendienst") $info = 0 endif Wend Func myadlib() $timer = $timer + 1 If $timer = 60 Then $info = 0 If $timer = 60 then $timer = 0 EndFunc Func myadlib2() $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop $msg2 = TrayGetMsg() If $msg2 = $exititem Then ExitLoop if $msg2 = $trayitem1 then GUISetState(@SW_SHOW) EndFunc Thank you for help! Edited April 2, 2005 by sebsabul Share this post Link to post Share on other sites
CyberSlug 6 Posted April 2, 2005 (edited) Double-click the tray icon to toggle window state. TraySetItemState($trayitem1, $TRAY_DEFAULT) ;just need to click the tray icon to select item TraySetClick(8) ; only show tray menu on right-click ;..... if $msg2 = $trayitem1 then If BitAND(2,WinGetState($InfoGui)) Then TraySetItemText($trayitem1, "Anzeigen") GUISetState(@SW_HIDE) Else TraySetItemText($trayitem1, "Verstecken") GUISetState(@SW_SHOW) EndIf EndIf COMPLETE CODE: expandcollapse popup#include <GUIConstants.au3> #Include <Constants.au3> #NoTrayIcon Opt("TrayMenuMode",1) $trayitem1 = TrayCreateItem("Anzeigen") TraySetItemState($trayitem1, $TRAY_DEFAULT);just need to click the tray icon to select item $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_HIDE) AdlibEnable("myadlib", 1000) AdlibEnable("myadlib2", 1) local $info = 0 local $wait = 1000 local $timer = 0 TraySetIcon("Shell32.dll",176) 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\send.massage.disabled.bat") sleep(2000) Run("net stop nachrichtendienst") $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\send.massage.disabled.bat") sleep(2000) Run("net stop nachrichtendienst") $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\send.massage.disabled.bat") sleep(2000) Run("net stop nachrichtendienst") $info = 0 endif Wend Func myadlib() $timer = $timer + 1 If $timer = 60 Then $info = 0 If $timer = 60 then $timer = 0 EndFunc Fu nc myadlib2() $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop $msg2 = TrayGetMsg() If $msg2 = $exititem Then ExitLoop if $msg2 = $trayitem1 then If BitAND(2,WinGetState($InfoGui)) Then TraySetItemText($trayitem1, "Anzeigen") GUISetState(@SW_HIDE) Else TraySetItemText($trayitem1, "Verstecken") GUISetState(@SW_SHOW) EndIf EndIf EndFunc Edited April 2, 2005 by CyberSlug 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
Jos 2,165 Posted April 2, 2005 (edited) PLEASE HELP!!!!<{POST_SNAPBACK}>3 posts in 1 hour.. When you are goofing around with the BETA release functions its less likely that ppl can help you quickly.. so either test yourself or be patient till somebody is able to help you....EDIT: ahh.. I see you got lucky .... CS came to the rescue Edited April 2, 2005 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Share this post Link to post Share on other sites
sebsabul 0 Posted April 2, 2005 THANK YOU FOR HELP! I´M SO HAPPY. SORRY FOR SO MUCH POSTS, BUT IN 2 DAYS : FOR ME THE SCHOOL BEGINNS AGAIN. thx Share this post Link to post Share on other sites
Westi 0 Posted April 2, 2005 Don't cry, but change send.massage.disabled.battosend.message.disabled.bat'cause i always want 'massage enabled', but only a 'message' returned But seriously, change .bat to .cmd or better translate it to .au3 to increase speed and intercept errors.PS: Ich wäre froh, nochmal nur zur Schule gehen zu müssen! Share this post Link to post Share on other sites