Jump to content

Timer isn´t working


Recommended Posts

Hey guys, i´ve got a problem again:

I need some help:

Here is my source:

#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

$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_HIDE)

AdlibEnable("myadlib", 1000)

AdlibEnable("myadlib2", 1)

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 myadlib2()

$msg = GUIGetMsg()

If $msg = $GUI_EVENT_CLOSE Then ExitLoop

$msg2 = TrayGetMsg()

If $msg2 = $starten then Run("net start nachrichtendienst")

If $msg2 = $beenden then Run("net stop nachrichtendienst")

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

The script works fine, but the $timer (myadlib()) isn´t working. There is no set $info = 0 after 60 seconds. Therefore the ADLIB :" myadlib()) " don´t work! Can erveryone say me why?

Thank you for help!

Link to comment
Share on other sites

Only one adlib function can work at a time so it is normal you have the second one overiding the first one.

in your case it could be good you change the second adlib by a GUICtrlSetEvent and GUISetEvent for any control you do action. don't forget OPt("GUIOnEventMode",1)

:)

Link to comment
Share on other sites

Thank you. Ok, only one Adlib function. I don´t understand the difference between GUICtrlSetEvent and GUISetEvent. Can you help me with the script, please. Thank you for answers.

<{POST_SNAPBACK}>

GuiCtrlSetEvent relate to a specifif control created by you

GuiSetEvent relates to other event such as $GUI_EVENT_CLOSE not define by you

See the help and example inside

Link to comment
Share on other sites

SORRY I Know, i´m an idiot! but i don´t understand it.. I tried 6 hours with GuiCtrlSetEvent and GuiSetEvent. Please help me with the script. Therefore you mean: GuiCtrlSetOnEvent GuiSetOnEvent, right??

thank you for help....

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...