NeoFoX Posted December 7, 2006 Share Posted December 7, 2006 First my little test-script: #include<GUIconstants.au3> #include<date.au3> GUICreate("",300,400) $Time = GUICtrlCreateDate ("23:59:59", 100, 112, 100, 20, $DTS_TIMEFORMAT) $Time_2 = GUICtrlCreateDate ("10:00:00", 100, 150, 100, 20, $DTS_TIMEFORMAT) $button = GUICtrlCreateButton("Ok",10,330,200,50) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE quit() Case $msg = $button test() EndSelect WEnd Func test() $tijd = GUICtrlRead($Time) MsgBox('','',$tijd) GUICtrlSetData($Time_2, "2006/10/10 " & $tijd) EndFunc Func quit() exit EndFunc Next my little problem: When you select a time in the first input and you press the Button, you see a nice msg-box saying that it's PM. After you pressed the OK-button in the msg-box it has to change the time in the second input to the same time as the first input.. But no matter which time it is, the second input is allways AM.. Even if you put the second time allready to PM, send the first time, it is still going back to AM.. what is wrong with it? Just a simple question with perhaps a simple answer Neo [center][font="Arial"]--- The Neo and Only --- [/font][font="Arial"]--Projects---[/font]Image to Text converterText to ASCII converter[/center] Link to comment Share on other sites More sharing options...
The Kandie Man Posted December 7, 2006 Share Posted December 7, 2006 This is because the time has to be set in 24-hour format. The following should fix your problem: #include<GUIconstants.au3> #include<date.au3> GUICreate("",300,400) $Time = GUICtrlCreateDate ("23:59:59", 100, 112, 100, 20, $DTS_TIMEFORMAT) $Time_2 = GUICtrlCreateDate ("10:00:00", 100, 150, 100, 20, $DTS_TIMEFORMAT) $button = GUICtrlCreateButton("Ok",10,330,200,50) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE quit() Case $msg = $button test() EndSelect WEnd Func test() $tijd = GUICtrlRead($Time) MsgBox('','',$tijd) ConsoleWrite('"' & $tijd &'"') IF StringRight($tijd,2) = "PM" Then GUICtrlSetData($Time_2, "2006/10/10 " & 12 + $tijd) Else GUICtrlSetData($Time_2, "2006/10/10 " & $tijd) Endif EndFunc Func quit() exit EndFunc "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
NeoFoX Posted December 7, 2006 Author Share Posted December 7, 2006 (edited) so.. why is the script taking the minutes and seconds from my official time and not from the input-time? Or is't necessary that you send the Hour,Min,Sec variables seperated to the time-box? Edited December 7, 2006 by NeoFoX [center][font="Arial"]--- The Neo and Only --- [/font][font="Arial"]--Projects---[/font]Image to Text converterText to ASCII converter[/center] Link to comment Share on other sites More sharing options...
The Kandie Man Posted December 7, 2006 Share Posted December 7, 2006 (edited) so.. why is the script taking the minutes and seconds from my official time and not from the input-time? Or is't necessary that you send the Hour,Min,Sec variables seperated to the time-box? Yeah, i see what you mean. Let me try and fix that. EDIT Func test() $tijd = GUICtrlRead($Time) ;~ MsgBox('','',$tijd) ConsoleWrite('"' & $tijd &'"') IF StringRight($tijd,2) = "PM" Then $as_time = StringSplit($tijd,":") GUICtrlSetData($Time_2, "2006/10/10 " & 12 + $as_time[1] &":"& $as_time[2] &":"& $as_time[3]) ;ConsoleWrite("2006/10/10 " & 12 + $as_time[1] &":"& $as_time[2] &":"& $as_time[3]) Else GUICtrlSetData($Time_2, "2006/10/10 " & STringTrimRight($tijd,3)) Endif EndFunc There, fixed Edited December 7, 2006 by The Kandie Man "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
NeoFoX Posted December 7, 2006 Author Share Posted December 7, 2006 Next question.. this one is heavy My real script is at the bottom of this msg... In this GUI you have a StartTime and an EndTime, what I can't figure out myself is that when the Starttime is equal to the endtime and you press the StartTime up with 1 hour.. the EndTime has to go up to. And, in the same situation, if you press the EndTime the StartTime has to stay which it's and the Endtime has go up by 1. A little example: StartTime = EndTime 10:00:00 PM 10:00:00 PM When StartTime pressed: 11:00:00 PM 11:00:00 PM When EndTime pressed: 10:00:00 PM 11:00:00 PM Is this possible or isn't, if it isn't I'll figure out something else Neo expandcollapse popup#include<GUIconstants.au3> #include<date.au3> Global $Sec, $Min, $Hour, $Time $physerv_gegevens = GUICreate("Physical Server", 450, 400, -1, -1) $image_label = GUICtrlCreateLabel("When full image?", 20, 10, 400, 40) GUICtrlSetFont($image_label, 15, 400, 2, "Georgia") $image_label_1 = GUICtrlCreateLabel("Sunday Monday Tuesday Wensday Thursday Friday Saterday", 20, 50, 500, 20) $checkbox_sun = GUICtrlCreateCheckbox("", 35, 65, 20, 20) GUICtrlSetState($checkbox_sun, $GUI_CHECKED) $checkbox_mon = GUICtrlCreateCheckbox("", 80, 65, 20, 20) $checkbox_tue = GUICtrlCreateCheckbox("", 133, 65, 20, 20) $checkbox_wed = GUICtrlCreateCheckbox("", 185, 65, 20, 20) GUICtrlSetState($checkbox_wed, $GUI_CHECKED) $checkbox_thu = GUICtrlCreateCheckbox("", 250, 65, 20, 20) $checkbox_fri = GUICtrlCreateCheckbox("", 300, 65, 20, 20) $checkbox_sat = GUICtrlCreateCheckbox("", 345, 65, 20, 20) GUICtrlSetState($checkbox_sat, $GUI_CHECKED) $image_tijd = GUICtrlCreateLabel("Starttime:", 20, 98, 50, 20) $image_tijd_totaal = GUICtrlCreateDate("22:00:00", 80, 95, 90, 20, $DTS_TIMEFORMAT) $incr_label = GUICtrlCreateLabel("When to update Image ", 20, 150, 400, 40) GUICtrlSetFont($incr_label, 13, 400, 2, "Georgia") $incr_label_1 = GUICtrlCreateLabel("Sunday Monday Tuesday Wensday Thursday Friday Saterday", 20, 180, 500, 20) $incr_sun = GUICtrlCreateCheckbox("", 35, 195, 20, 20) $incr_mon = GUICtrlCreateCheckbox("", 80, 195, 20, 20) GUICtrlSetState($incr_mon, $GUI_CHECKED) $incr_tue = GUICtrlCreateCheckbox("", 133, 195, 20, 20) GUICtrlSetState($incr_tue, $GUI_CHECKED) $incr_wed = GUICtrlCreateCheckbox("", 185, 195, 20, 20) GUICtrlSetState($incr_wed, $GUI_CHECKED) $incr_thu = GUICtrlCreateCheckbox("", 250, 195, 20, 20) GUICtrlSetState($incr_thu, $GUI_CHECKED) $incr_fri = GUICtrlCreateCheckbox("", 300, 195, 20, 20) GUICtrlSetState($incr_fri, $GUI_CHECKED) $incr_sat = GUICtrlCreateCheckbox("", 345, 195, 20, 20) $incr_st_tijd = GUICtrlCreateLabel("Starttime:", 20, 228, 50, 20) $incr_st_tijd_totaal = GUICtrlCreateDate("09:00:00", 80, 225, 90, 20, $DTS_TIMEFORMAT) $incr_et_tijd = GUICtrlCreateLabel("Endtime:", 20, 255, 50, 20) $incr_et_tijd_totaal = GUICtrlCreateDate("17:00:00", 80, 250, 90, 20, $DTS_TIMEFORMAT) $incr_aantal_label = GUICtrlCreateLabel("Hours between updates:", 20, 282, 150, 20) $incr_aantal_uur = GuiCtrlCreateInput("1", 170, 280, 35, 20, BitOR($ES_NUMBER, $ES_CENTER, $ES_READONLY)) $incr_aantal_1 = GuiCtrlCreateUpDown($incr_aantal_uur) GUICtrlSetLimit($incr_aantal_1, 8, 1) $incr_wordt = GUICtrlCreateLabel("This will be a total of ", 20, 310, 100, 20) $incr_wordt_1 = GUICtrlCreateLabel("updates!!", 140, 310, 150, 20) $incr_wordt_2 = GUICtrlCreateInput("9", 116, 308, 20, 22, Bitor($ES_NUMBER, $ES_CENTER, $ES_READONLY), $WS_EX_TRANSPARENT) GUICtrlSetFont($incr_wordt_2, 13, 400, "", "") $button_serv_ok = GUICtrlCreateButton ("&Ok", 175, 340, 100, 30) $button_serv_cancel = GUICtrlCreateButton ("&Cancel", 300, 340, 100, 30) GUISetState() While 1 berekening() test() ;--> if you command-out this line, you will see what actualy happens... $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE or $msg = $button_serv_cancel quit() EndSelect WEnd Func test() $tijd = GUICtrlRead($incr_st_tijd_totaal) IF StringRight($tijd,2) = "PM" Then $as_time = StringSplit($tijd,":") GUICtrlSetData($incr_et_tijd_totaal, "2006/10/10 " & 12 + $as_time[1] &":"& $as_time[2] &":"& $as_time[3]) Else GUICtrlSetData($incr_et_tijd_totaal, "2006/10/10 " & STringTrimRight($tijd,3)) Endif EndFunc Func Berekening() $check_tijd = StringSplit(Guictrlread($image_tijd_totaal), ":") If $check_tijd[3] = "00 AM" Or $check_tijd[3] = "00 PM" Then $check_am_pm = StringSplit($check_tijd[3], " ") $st_uur = StringSplit(Guictrlread($incr_st_tijd_totaal), ":") $st_minuut = Stringsplit($st_uur[3], " ") $st_am_pm = $st_minuut[2] $et_uur = StringSplit(Guictrlread($incr_et_tijd_totaal), ":") $et_minuut = Stringsplit($et_uur[3], " ") $et_am_pm = $et_minuut[2] $maxuur = 12 $minuur = 1 If $st_am_pm = "AM" AND $et_am_pm = "AM" Then $totaal = Int(($et_uur[1] - $st_uur[1]) / GUICtrlRead($incr_aantal_uur) + 1) GUICtrlSetData($incr_wordt_2, $totaal) ElseIf $st_am_pm = "PM" And $et_am_pm = "PM" Then $totaal = Int(($et_uur[1] - $st_uur[1]) / GUICtrlRead($incr_aantal_uur) + 1) GUICtrlSetData($incr_wordt_2, $totaal) ElseIf $st_am_pm = "AM" And $et_am_pm = "PM" Then $totaal = int((($maxuur - $st_uur[1]) + ($et_uur[1] - $minuur)) / GUICtrlRead($incr_aantal_uur) + 2) GUICtrlSetData($incr_wordt_2, $totaal) EndIf Else $st_tijd = StringSplit(Guictrlread($incr_st_tijd_totaal), ":") $et_tijd = StringSplit(Guictrlread($incr_et_tijd_totaal), ":") $totaal = Int(($et_tijd[1] - $st_tijd[1] - 1) / GUICtrlRead($incr_aantal_uur) + 2) GUICtrlSetData($incr_wordt_2, $totaal) EndIf EndFunc Func quit() exit EndFunc [center][font="Arial"]--- The Neo and Only --- [/font][font="Arial"]--Projects---[/font]Image to Text converterText to ASCII converter[/center] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now