Sign in to follow this  
Followers 0
sebsabul

Windows SHOW /HIDE

7 posts in this topic

#1 ·  Posted (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 by sebsabul

Share this post


Link to post
Share on other sites



Can anyone help?

Share this post


Link to post
Share on other sites

PLEASE HELP!!!!

Share this post


Link to post
Share on other sites

#4 ·  Posted (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:

#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 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

#5 ·  Posted (edited)

PLEASE HELP!!!!

<{POST_SNAPBACK}>

3 posts in 1 hour.. :D

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 by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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

Don't cry, but change

send.massage.disabled.bat
to
send.message.disabled.bat
'cause i always want 'massage enabled', but only a 'message' returned :):D

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

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0