Sign in to follow this  
Followers 0
Bert

Timer problem

5 posts in this topic

I'm working with a timer that I need to put a alarm on it. I can get the alarm to work, however I need to have it so the user can only enter in a certain range. (1 to 8 hours)

I tried this, but it didn't work.

if $msg = $TButton_[$xk] And GUICtrlRead($InputA_[$xk]) < 1 And GUICtrlRead($InputA_[$xk]) > 8 Then msgbox(0, "Error!", "You must enter in hours between 1 and 8")
        If $msg = $TButton_[$xk] And GUICtrlRead($Input_[$xk]) > "" Then  
            GUICtrlSetState($TButton_[$xk], $GUI_DISABLE)
            GUICtrlSetState($Input_[$xk], $GUI_DISABLE)
            $TimerActive_[$xk] = 1
            $Timer_[$xk] = TimerInit()
        elseif $msg = $TButton_[$xk] then                 
            MsgBox(64, "User Error", "Please Type in a Ticket Number   ", 3)

Share this post


Link to post
Share on other sites



Didn't we already do this for you _TimeToTicks?


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

this is something a little different. I added a field in the upper right corner that allows for the user to pick how many hours they want to clock to run before the alarm goes off. All I need is a way so if they enter >8 or <1 they would get a error message. I can post the entire code if you needed it.

Share this post


Link to post
Share on other sites

I just figured it out.

$hrc = GUICtrlRead($InputA_[$xk])
        if $msg = $TButton_[$xk] And $hrc < 1 Then msgbox(0, "Error!", "You must enter in hours between 1 and 8")
        if $msg = $TButton_[$xk] And $hrc > 8 Then msgbox(0, "Error!", "You must enter in hours between 1 and 8")
        If $msg = $TButton_[$xk] And GUICtrlRead($Input_[$xk]) > "" Then  
            GUICtrlSetState($TButton_[$xk], $GUI_DISABLE)
            GUICtrlSetState($Input_[$xk], $GUI_DISABLE)
            $TimerActive_[$xk] = 1
            $Timer_[$xk] = TimerInit()
        elseif $msg = $TButton_[$xk] then                 
            MsgBox(64, "User Error", "Please Type in a Ticket Number   ", 3)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

maybe this

If $msg = $TButton_[$xk] Then
    $hrc = GUICtrlRead($InputA_[$xk])
    If $hrc < 1 Or $hrc > 8 Then
        MsgBox(0, "Error!", "You must enter in hours between 1 and 8")
    ;Return for a function or ContinueLoop for While/Wend
    EndIf
    If GUICtrlRead($Input_[$xk]) > "" Then
        GUICtrlSetState($TButton_[$xk], $GUI_DISABLE)
        GUICtrlSetState($Input_[$xk], $GUI_DISABLE)
        $TimerActive_[$xk] = 1
        $Timer_[$xk] = TimerInit()
    Else MsgBox(64, "User Error", "Please Type in a Ticket Number   ", 3)
    EndIf
EndIf

8)

Edited by Valuater

NEWHeader1.png

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