# if and Endif problem

## Recommended Posts

its supposed to be a clock that when you activate this function it wil give +5 min

;\$Input12= minutes
;\$Input11= hour
;\$Input10= day

If GUICtrlRead(\$Input12) < 60  Then   ;minutes
GUICtrlSetData(\$Input12, 0)
EndIf

GUICtrlSetData(\$Input11, 0)
EndIf

the minutes are working for every 6 clicks ( 6*5(min)) +1 hour

but everytime I activate this  it also gives +1 hour

I dont understand this  I clearly set \$input11 <24 (hour) then......

could somebody help me with this

##### Share on other sites

the minutes are working for every 6 clicks ( 6*5(min)) +1 hour

What is a "click" with regards your script?

Can you post a working example?

Monkey's are, like, natures humans.

##### Share on other sites

yes off course

#include <GUIConstantsEx.au3>

\$Form1_1_1_1 = GUICreate("forum", 773, 489, 247, 202)
\$Input8 = GUICtrlCreateInput("2014", 480, 440, 33, 21)
\$jaar = GUICtrlCreateLabel("jaar", 488, 424, 21, 17)
\$Input9 = GUICtrlCreateInput("05", 512, 440, 33, 21)
\$maand = GUICtrlCreateLabel("maand", 512, 424, 36, 17)
\$Input10 = GUICtrlCreateInput("01", 544, 440, 33, 21)
\$dag = GUICtrlCreateLabel("dag", 552, 424, 22, 17)
\$Input11 = GUICtrlCreateInput("12", 584, 440, 33, 21)
\$uur = GUICtrlCreateLabel("uur", 592, 424, 19, 17)
\$Input12 = GUICtrlCreateInput("05", 616, 440, 33, 21)
\$min = GUICtrlCreateLabel("min", 624, 424, 20, 17)
\$Input13 = GUICtrlCreateInput("02", 648, 440, 33, 21)
\$sec = GUICtrlCreateLabel("sec", 656, 424, 21, 17)
\$plus = GUICtrlCreateButton("5min", 680, 440, 33, 25)
\$1min = GUICtrlCreateButton("1min", 712, 440, 33, 25)
GUISetState()

While 1
\$nMsg = GUIGetMsg()
Switch \$nMsg
Case \$GUI_EVENT_CLOSE

case \$plus
GUICtrlSetData(\$Input12, 0)
EndIf

GUICtrlSetData(\$Input11, 0)
EndIf
EndSwitch
WEnd

##### Share on other sites

There is an "Exit" statement missing.

Case \$GUI_EVENT_CLOSE
Exit   <=====

UDF: _SingleScript()                                        If you like my post, just click the like button         here -->

##### Share on other sites

There is an "Exit" statement missing.

Case \$GUI_EVENT_CLOSE

Exit   <=====

yes sorry i forgot that, but that was not the problem that i was trying to solve

##### Share on other sites

#include <GUIConstantsEx.au3>

\$Form1_1_1_1 = GUICreate("forum", 773, 489, 247, 202)
\$Input8 = GUICtrlCreateInput("2014", 480, 440, 33, 21)
\$jaar = GUICtrlCreateLabel("jaar", 488, 424, 21, 17)
\$Input9 = GUICtrlCreateInput("05", 512, 440, 33, 21)
\$maand = GUICtrlCreateLabel("maand", 512, 424, 36, 17)
\$Input10 = GUICtrlCreateInput("01", 544, 440, 33, 21)
\$dag = GUICtrlCreateLabel("dag", 552, 424, 22, 17)
\$Input11 = GUICtrlCreateInput("12", 584, 440, 33, 21)
\$uur = GUICtrlCreateLabel("uur", 592, 424, 19, 17)
\$Input12 = GUICtrlCreateInput("05", 616, 440, 33, 21)
\$min = GUICtrlCreateLabel("min", 624, 424, 20, 17)
\$Input13 = GUICtrlCreateInput("02", 648, 440, 33, 21)
\$sec = GUICtrlCreateLabel("sec", 656, 424, 21, 17)
\$plus = GUICtrlCreateButton("5min", 680, 440, 33, 25)
\$1min = GUICtrlCreateButton("1min", 712, 440, 33, 25)
GUISetState()

While 1
\$nMsg = GUIGetMsg()
Switch \$nMsg
Case \$GUI_EVENT_CLOSE
Exit
Case \$plus
GUICtrlSetData(\$Input12, 0)
EndIf

#cs
GUICtrlSetData(\$Input11, 0)
EndIf
#ce
EndSwitch
WEnd

Monkey's are, like, natures humans.

##### Share on other sites
#include <GUIConstantsEx.au3>

\$Form1_1_1_1 = GUICreate("forum", 773, 489, 247, 202)
\$Input8 = GUICtrlCreateInput("2014", 480, 440, 33, 21)
\$jaar = GUICtrlCreateLabel("jaar", 488, 424, 21, 17)
\$Input9 = GUICtrlCreateInput("05", 512, 440, 33, 21)
\$maand = GUICtrlCreateLabel("maand", 512, 424, 36, 17)
\$Input10 = GUICtrlCreateInput("01", 544, 440, 33, 21)
\$dag = GUICtrlCreateLabel("dag", 552, 424, 22, 17)
\$Input11 = GUICtrlCreateInput("12", 584, 440, 33, 21)
\$uur = GUICtrlCreateLabel("uur", 592, 424, 19, 17)
\$Input12 = GUICtrlCreateInput("05", 616, 440, 33, 21)
\$min = GUICtrlCreateLabel("min", 624, 424, 20, 17)
\$Input13 = GUICtrlCreateInput("02", 648, 440, 33, 21)
\$sec = GUICtrlCreateLabel("sec", 656, 424, 21, 17)
\$plus = GUICtrlCreateButton("5min", 680, 440, 33, 25)
\$1min = GUICtrlCreateButton("1min", 712, 440, 33, 25)
GUISetState()

While 1
\$nMsg = GUIGetMsg()
Switch \$nMsg
Case \$GUI_EVENT_CLOSE
Exit
Case \$plus
GUICtrlSetData(\$Input12, 0)
EndIf

#cs
GUICtrlSetData(\$Input11, 0)
EndIf
#ce
EndSwitch
WEnd

Thank you but why is the hour (uur) input passing 24 and the "day" input doesnt give +1 after 24 hour

##### Share on other sites

Because it was not being checked, was just showing how hours minutes could work.

While 1
\$nMsg = GUIGetMsg()
Switch \$nMsg
Case \$GUI_EVENT_CLOSE
Exit
Case \$plus
GUICtrlSetData(\$Input12, 0)
EndIf

GUICtrlSetData(\$Input11, 0)
EndIf

EndSwitch
WEnd

Monkey's are, like, natures humans.

##### Share on other sites

ok thank very much for you help JohnOne

##### Share on other sites

Just another solution without if/endif.

#include <GUIConstantsEx.au3>
#include <Date.au3>
#include <array.au3>
Opt("GUICoordMode", 0)

\$GUI = GUICreate("forum", 773, 489, 247, 202)
GUICtrlCreateLabel("YYYY   MM  DD     hh   mm   ss", 488, 424)
\$year = GUICtrlCreateInput(@YEAR, 0, 16, 33)
\$mon = GUICtrlCreateInput(@MON, 35, 0, 20)
\$day = GUICtrlCreateInput(@MDAY, 22, 0, 20)
\$hour = GUICtrlCreateInput(@HOUR, 33, 0, 20)
\$min = GUICtrlCreateInput(@MIN, 22, 0, 20)
\$sec = GUICtrlCreateInput(@SEC, 22, 0, 20)
\$plus5min = GUICtrlCreateButton("5min", 33, 0, 33)
\$plus1min = GUICtrlCreateButton("1min", 33, 0, 33)
GUISetState()

While 1
\$plus = 1
\$nMsg = GUIGetMsg()
Switch \$nMsg
Case \$GUI_EVENT_CLOSE
Exit
Case \$plus5min
\$plus = 5
ContinueCase
Case \$plus1min
GUICtrlRead(\$day) & " " & _
If @error Then Exit MsgBox(262144, "Debug " & @ScriptName, "@Error: " & @error & @LF & "@Extended: " & @extended & @LF & "@ScriptLineNumber: " & @ScriptLineNumber & @LF & "_DateAdd() failed. Invalid input. Try again...", 0)
;~          MsgBox(64 + 262144, " ", \$newdate, 0)
\$aDate = StringSplit(\$newdate, "/ :", 0)
EndSwitch
WEnd
Edited by Exit

UDF: _SingleScript()                                        If you like my post, just click the like button         here -->

## Create an account

Register a new account

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...