|
You last visited: Today at 13:31
Advertisement
Uhrzeit in Autoit
Discussion on Uhrzeit in Autoit within the AutoIt forum part of the Coders Den category.
11/26/2011, 13:06
|
#1
|
elite*gold: 726
Join Date: Jul 2010
Posts: 14,233
Received Thanks: 7,914
|
Timer mit Stunden
Ich versuche einen Timer zu machen der nach einer bestimmten zeit (Stunden und Minuten) eine funktion macht.
So funktioniert alles so wie ich das will:
PHP Code:
$titel = "" ; $DauerStd = 44 $DauerMin = 77 $DauerSek = 0 $DauerGesammt = (60*60*$DauerStd)+(60*$DauerMin)+$DauerSek
While 1 Sleep(250) WEnd
AdlibRegister("_start",1000)
Func _start() ToolTip("Restzeit: " & _Sek2StdMinSek($DauerGesammt),0,0,"",1) If $DauerGesammt = 0 Then _toDo() $DauerGesammt = $DauerGesammt - 1 EndFunc
Func _toDo() AdlibUnRegister("_start") Shutdown 1 Exit EndFunc
Func _Sek2StdMinSek($value) $format1 = "%02d:%02d:%02d" $format2 = "%02d:%02d" $format3 = "%02d Std. %02d Min. %02d Sek." $format4 = "%02d Std. %02d Min."
$std = Floor($value / (60*60)) $value = $value - ((60*60) * $std) $min = Floor($value / (60)) $sek = $value - ((60) * $min)
Return StringFormat($format3,$std,$min,$sek) EndFunc
Nur wenn ich das dann unter meine Gui packe funktioniert das nicht mehr.
PHP Code:
$isHide = False $bVisible = True HotKeySet("{F6}","_hideshow") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE _hideshow() Case $Menu_File_Item1 If GUICtrlRead($Menu_File_Item1) Then _StartIn() Case $Menu_File_Item2 _hideshow() Case $Menu_File_Item3 Exit Case $Menu_File_Item4 ShellExecute ("www.elitepvpers.com") Case $Menu_File_Item5 ShellExecute ("www.elitepvpers.com") EndSwitch
$msg = TrayGetMsg() Switch $msg Case $miExit Exit Case $miWeb ShellExecute("www.elitepvpers.com") Case $miHide _hideshow() EndSwitch WEnd
$titel = "" ; $DauerStd = 44 $DauerMin = 77 $DauerSek = 0 $DauerGesammt = (60*60*$DauerStd)+(60*$DauerMin)+$DauerSek
While 1 Sleep(250) WEnd
AdlibRegister("_start",1000)
Func _start() ToolTip("Restzeit: " & _Sek2StdMinSek($DauerGesammt),0,0,"",1) If $DauerGesammt = 0 Then _toDo() $DauerGesammt = $DauerGesammt - 1 EndFunc
Func _toDo() AdlibUnRegister("_start") Shutdown 1 Exit EndFunc
Func _Sek2StdMinSek($value) $format1 = "%02d:%02d:%02d" $format2 = "%02d:%02d" $format3 = "%02d Std. %02d Min. %02d Sek." $format4 = "%02d Std. %02d Min."
$std = Floor($value / (60*60)) $value = $value - ((60*60) * $std) $min = Floor($value / (60)) $sek = $value - ((60) * $min)
Return StringFormat($format3,$std,$min,$sek) EndFunc
Weiß jmd woran das liegt? Ich probiere das schon fast 2h ._. Fals jmd. das ganze script brauch bitte melden.
|
|
|
11/26/2011, 13:10
|
#2
|
elite*gold: 0
Join Date: Nov 2009
Posts: 221
Received Thanks: 71
|
du könntest das so lösen
Code:
If @HOUR & ":" & @MIN="13:30" Then
run("deinProgramm")
EndIf
|
|
|
11/26/2011, 13:58
|
#3
|
elite*gold: 726
Join Date: Jul 2010
Posts: 14,233
Received Thanks: 7,914
|
Ich habe das jetzt so, wie müsste ich das verbessern?
PHP Code:
Func _startAt() $DauerStd2 = GUICtrlRead($Input3) $DauerMin2 = GUICtrlRead($Input4) If @HOUR=$DauerStd2 And @MIN=$DauerMin2 Then MsgBox("hey, funzt");_toDo() EndFunc
|
|
|
11/26/2011, 14:00
|
#4
|
elite*gold: 0
Join Date: Nov 2011
Posts: 49
Received Thanks: 5
|
An sich garnicht passt doch alles so oder nicht ?
|
|
|
11/26/2011, 14:16
|
#5
|
elite*gold: 726
Join Date: Jul 2010
Posts: 14,233
Received Thanks: 7,914
|
Ach ich bin so Dumm -.- While/Wend Schleife vergessen.
#clsrqst.
|
|
|
11/27/2011, 14:32
|
#6
|
elite*gold: 726
Join Date: Jul 2010
Posts: 14,233
Received Thanks: 7,914
|
#neues Problem - siehe oben.
|
|
|
11/27/2011, 14:47
|
#7
|
elite*gold: 2
Join Date: Jul 2009
Posts: 14,456
Received Thanks: 4,685
|
AdLib mal in der obersten While callen.
|
|
|
11/27/2011, 14:53
|
#8
|
elite*gold: 0
Join Date: Nov 2009
Posts: 221
Received Thanks: 71
|
du kommst nicht über deine while schleife raus
Code:
[COLOR=#007700][FONT=Courier New]While [/FONT][/COLOR][FONT=Courier New][COLOR=#0000bb]1
Sleep[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]250[/COLOR][/FONT][COLOR=#007700][FONT=Courier New])
[/FONT][/COLOR][FONT=Courier New][COLOR=#0000bb]WEnd
AdlibRegister[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]"_start"[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000bb]1000[/COLOR][/FONT][COLOR=#007700][FONT=Courier New])[/FONT]
[/COLOR]
|
|
|
11/27/2011, 17:04
|
#9
|
elite*gold: 280
Join Date: May 2007
Posts: 2,818
Received Thanks: 3,483
|
timer sollten immer über timerfunktionen laufen
hier ein beispielcode, welcher alle 2 sekunden etwas in die console schreibt
Code:
Dim $timer = TimerInit()
While 1
If TimerDiff($timer) > 2000 Then
ConsoleWrite('BAM'&@CRLF)
$timer = TimerInit()
EndIf
WEnd
|
|
|
11/28/2011, 16:09
|
#10
|
elite*gold: 726
Join Date: Jul 2010
Posts: 14,233
Received Thanks: 7,914
|
Quote:
Originally Posted by bollen
du kommst nicht über deine while schleife raus
Code:
[COLOR=#007700][FONT=Courier New]While [/FONT][/COLOR][FONT=Courier New][COLOR=#0000bb]1
Sleep[/COLOR][COLOR=#007700]([/COLOR][COLOR=#0000bb]250[/COLOR][/FONT][COLOR=#007700][FONT=Courier New])
[/FONT][/COLOR][FONT=Courier New][COLOR=#0000bb]WEnd
AdlibRegister[/COLOR][COLOR=#007700]([/COLOR][COLOR=#dd0000]"_start"[/COLOR][COLOR=#007700],[/COLOR][COLOR=#0000bb]1000[/COLOR][/FONT][COLOR=#007700][FONT=Courier New])[/FONT]
[/COLOR]
|
Genauer Bitte
Quote:
Originally Posted by lolkop
timer sollten immer über timerfunktionen laufen
hier ein beispielcode, welcher alle 2 sekunden etwas in die console schreibt
Code:
Dim $timer = TimerInit()
While 1
If TimerDiff($timer) > 2000 Then
ConsoleWrite('BAM'&@CRLF)
$timer = TimerInit()
EndIf
WEnd
|
Wie soll man dann so ein Timer machen wenn man in 2 Gui Inputfelder einmal "Stunden" und "Minuten" eingibt?
|
|
|
11/28/2011, 18:43
|
#11
|
elite*gold: 280
Join Date: May 2007
Posts: 2,818
Received Thanks: 3,483
|
millisekunden umrechnen in stunden minuten und sekunden sollte doch nicht so das problem sein oder? :P
ansonsten noch einfacher, aber auch ungenauer, sekündlich runter zählen...
Code:
GUICreate('timer', 220, 100, Default, Default, 0x10C80000)
Dim $timer=0, $running = False, $input[3], $label[3], $name[3]=['Stunden','Minuten','Sekunden'], $button[2]=['Start','Pause']
For $i=0 To 2
GUICtrlCreateGroup($name[$i], 5+70*$i, 5, 70, 40)
$input[$i]=GUICtrlCreateInput('', 10+70*$i, 20, 60, 20, 1)
$label[$i]=GUICtrlCreateLabel('0', 10+70*$i, 50, 60, 20, 0x1001)
Next
$go=GUICtrlCreateButton('Start', 10, 75, 100, 20)
$reset=GUICtrlCreateButton('Reset', 110, 75, 100, 20)
While 1
Switch GUIGetMsg()
Case -3
Exit
Case $go
$running = Not $running
GUICtrlSetData($go, $button[$running])
If $timer=0 Then
For $i=0 To 2
GUICtrlSetData($label[$i], GUICtrlRead($input[$i]))
Next
EndIf
$timer = TimerInit()
Case $reset
For $i=0 To 2
GUICtrlSetData($label[$i], GUICtrlRead($input[$i]))
Next
$timer=0
Case Else
If $running Then
$std = GUICtrlRead($label[0])
$min = GUICtrlRead($label[1])
$sec = GUICtrlRead($label[2])
If TimerDiff($timer)>=1000 Then
$timer = TimerInit()
If $sec<=0 Then
If $min<=0 Then
If $std>0 Then
GUICtrlSetData($label[0], $std-1)
GUICtrlSetData($label[1], 60)
GUICtrlSetData($label[2], 60)
EndIf
Else
GUICtrlSetData($label[1], $min-1)
GUICtrlSetData($label[2], 60)
EndIf
Else
GUICtrlSetData($label[2], $sec-1)
EndIf
EndIf
If Done($label)Then
$running=False
GUICtrlSetData($go, $button[$running])
$timer=0
MsgBox(0, 'Info', 'Game Over!')
EndIf
EndIf
EndSwitch
WEnd
Func Done($array)
For $i=0 To 2
If GUICtrlRead($array[$i])<>0 Then Return False
Next
Return True
EndFunc
|
|
|
11/28/2011, 22:10
|
#12
|
elite*gold: 726
Join Date: Jul 2010
Posts: 14,233
Received Thanks: 7,914
|
Quote:
Originally Posted by lolkop
millisekunden umrechnen in stunden minuten und sekunden sollte doch nicht so das problem sein oder? :P
ansonsten noch einfacher, aber auch ungenauer, sekündlich runter zählen...
Code:
GUICreate('timer', 220, 100, Default, Default, 0x10C80000)
Dim $timer=0, $running = False, $input[3], $label[3], $name[3]=['Stunden','Minuten','Sekunden'], $button[2]=['Start','Pause']
For $i=0 To 2
GUICtrlCreateGroup($name[$i], 5+70*$i, 5, 70, 40)
$input[$i]=GUICtrlCreateInput('', 10+70*$i, 20, 60, 20, 1)
$label[$i]=GUICtrlCreateLabel('0', 10+70*$i, 50, 60, 20, 0x1001)
Next
$go=GUICtrlCreateButton('Start', 10, 75, 100, 20)
$reset=GUICtrlCreateButton('Reset', 110, 75, 100, 20)
While 1
Switch GUIGetMsg()
Case -3
Exit
Case $go
$running = Not $running
GUICtrlSetData($go, $button[$running])
If $timer=0 Then
For $i=0 To 2
GUICtrlSetData($label[$i], GUICtrlRead($input[$i]))
Next
EndIf
$timer = TimerInit()
Case $reset
For $i=0 To 2
GUICtrlSetData($label[$i], GUICtrlRead($input[$i]))
Next
$timer=0
Case Else
If $running Then
$std = GUICtrlRead($label[0])
$min = GUICtrlRead($label[1])
$sec = GUICtrlRead($label[2])
If TimerDiff($timer)>=1000 Then
$timer = TimerInit()
If $sec<=0 Then
If $min<=0 Then
If $std>0 Then
GUICtrlSetData($label[0], $std-1)
GUICtrlSetData($label[1], 60)
GUICtrlSetData($label[2], 60)
EndIf
Else
GUICtrlSetData($label[1], $min-1)
GUICtrlSetData($label[2], 60)
EndIf
Else
GUICtrlSetData($label[2], $sec-1)
EndIf
EndIf
If Done($label)Then
$running=False
GUICtrlSetData($go, $button[$running])
$timer=0
MsgBox(0, 'Info', 'Game Over!')
EndIf
EndIf
EndSwitch
WEnd
Func Done($array)
For $i=0 To 2
If GUICtrlRead($array[$i])<>0 Then Return False
Next
Return True
EndFunc
|
Ja sowas habe ich gesucht, wie kann ich das einbauen das in der GUI nicht die Zeit angezeigt wird?
|
|
|
11/28/2011, 22:57
|
#13
|
elite*gold: 280
Join Date: May 2007
Posts: 2,818
Received Thanks: 3,483
|
das ist natürlich noch einfacher. dann brauchst du ja lediglich ein timerinit setzen, und nach der endzeit das ganze zuschlagen lassn...
Code:
GUICreate('timer', 220, 70, Default, Default, 0x10C80000)
Dim $end, $timer, $running = False, $input[3], $name[3]=['Stunden','Minuten','Sekunden'], $button[2]=['Start','Stop']
For $i=0 To 2
GUICtrlCreateGroup($name[$i], 5+70*$i, 5, 70, 40)
$input[$i]=GUICtrlCreateInput('', 10+70*$i, 20, 60, 20, 1)
Next
$go=GUICtrlCreateButton('Start', 5, 45, 210, 20)
While 1
Switch GUIGetMsg()
Case -3
Exit
Case $go
$running = Not $running
GUICtrlSetData($go, $button[$running])
$end = Convert($input)
$timer=TimerInit()
Case Else
If $running And TimerDiff($timer)>=$end Then
$running = False
GUICtrlSetData($go, $button[$running])
MsgBox(0, 'Info', 'Game Over')
EndIf
EndSwitch
WEnd
Func Convert($array)
Return 1000*(60*(60*(GUICtrlRead($array[0]))+GUICtrlRead($array[1]))+GUICtrlRead($array[2]))
EndFunc
|
|
|
Similar Threads
|
Ingame Uhrzeit?
08/01/2011 - Metin2 Private Server - 9 Replies
Hallo Epvp,
da Crank leider alle seine Threads gelöscht hat, würde ich gerne wissen, wie man nochmal die grüne Ingame Uhrzeit aktiviert.
Ich hoffe, ihr könnt mir helfen.
|
Uhrzeit falsch?
04/01/2011 - Main - 5 Replies
Erledigt
|
höhö Uhrzeit
07/22/2010 - Off Topic - 9 Replies
Batitun ist schuld er hat mich angestiftet
LACH
|
Frage zu AUtoIT Uhrzeit
04/30/2010 - General Coding - 1 Replies
Hi
und zwar will ich nen Code, der bis zu einer bestimmtn Uhrzeit mein Script ausführt!
Geht das?
also z.B ich kann in ein Input Feld eingeben 18:30 und dann läuft immer das selbe Script bis um 18:30 Uhr
MFG
|
Uhrzeit von pc ablesen
03/10/2009 - General Coding - 7 Replies
ist es möglich das ich die Uhrzeit von PC oder Internet ausles?wenn ja wie?
Edit sry vergessen in AutoIT scripten
|
All times are GMT +2. The time now is 13:31.
|
|