Sign in to follow this  
Followers 0
Madza91

If label = 23:00 then...

9 posts in this topic

Why not working this:

#include <GUIConstants.au3>

#include <Date.au3>

$Main = GUICreate("Automation Program", 500, 400, -1, -1)

$btnStart5 = GUICtrlCreateButton("Exit", 200, 40, 81, 25, 0)

$lblTime = GUICtrlCreateLabel( _NowTime() ,170,80,150,25)

$lastsec = @SEC

GUISetState(@SW_SHOW)

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

GUIDelete()

Exit

Case $msg = $btnStart5

MsgBox(0x0, "Click", "you clicked Exit ", 3)

Exit

EndSelect

updateTime()

WEnd

If $lblTime = "23:00:00" Then

GUICtrlCreateButton("Start", 100, 40, 81, 25, 0)

EndIf

Func updateTime()

$cursec = @SEC

if $cursec <> $lastsec Then

$lastsec = $cursec

GUICtrlSetData($lblTime,_NowTime())

EndIf

EndFunc

I want to create button if is label = 23:00:00 :|


[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

I know for normal label, but how to use GuiCtrlRead() on this clock label? <_<

Edited by n3nE

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Share this post


Link to post
Share on other sites

yes <_<

See this:

#include <GUIConstants.au3>

#include <Date.au3>

$Main = GUICreate("Automation Program", 500, 400, -1, -1)

$btnStart5 = GUICtrlCreateButton("Exit", 200, 40, 81, 25, 0)

$lblTime = GUICtrlCreateLabel( _NowTime() ,170,80,150,25)

$lastsec = @SEC

GUISetState(@SW_SHOW)

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

GUIDelete()

Exit

Case $msg = $btnStart5

MsgBox(0x0, "Click", "you clicked Exit ", 3)

Exit

EndSelect

updateTime()

WEnd

$item = GUICtrlRead($lblTime)

If $item = "23:14:20" Then

GUICtrlCreateButton("Start", 100, 40, 81, 25, 0)

EndIf

Func updateTime()

$cursec = @SEC

if $cursec <> $lastsec Then

$lastsec = $cursec

GUICtrlSetData($lblTime,_NowTime())

EndIf

EndFunc

With GUICtrlRead but not working :S


[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

You dont understand me...

I MADED THIS BUT WITH BUG :/

#include <GUIConstants.au3>

#include <Date.au3>

$Main = GUICreate("Automation Program", 500, 400, -1, -1)

$btnStart5 = GUICtrlCreateButton("Exit", 200, 40, 81, 25, 0)

$lblTime = GUICtrlCreateLabel( _NowTime() ,170,80,150,25)

$lastsec = @SEC

GUISetState(@SW_SHOW)

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

GUIDelete()

Exit

Case $msg = $btnStart5

MsgBox(0x0, "Click", "you clicked Exit ", 3)

Exit

EndSelect

updateTime()

If GuiCtrlRead($lblTime) == "23:27:10" Then

GUICtrlCreateButton("Start", 100, 40, 81, 25, 0)

EndIf

WEnd

Func updateTime()

$cursec = @SEC

if $cursec <> $lastsec Then

$lastsec = $cursec

GUICtrlSetData($lblTime,_NowTime())

EndIf

EndFunc

START button is bugged :S

Edited by n3nE

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Not bugged. You forgot to add AM or PM in here:

If GuiCtrlRead($lblTime) == "9:59:50 PM" Then

<_< Does it work now? It worked for me. That's the time it was when I did it.

To make it more dependable, you might want to pass a parameter to _NowTime. Without a parameter it will use the local computer's settings, which may be different than what you are checking for.

The Start button looks a little funny at first, because the loop runs many times during that one second, so it keeps loading the button. You could fix that, though. just ask if you dont know how.

I hope I fixed it for you.

Edited by Nevin

Share this post


Link to post
Share on other sites

Yes, tnx man <_<


[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

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