Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 11:07

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Ein Timer in ein Label einbauen

Discussion on Ein Timer in ein Label einbauen within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Nov 2010
Posts: 71
Received Thanks: 5
Post Ein Timer in ein Label einbauen

Hallo,

ich bin dabei ein Mathe Trainer zu schreiben.
Und möchte das so machen:
man hat z.b 10 Sekunden um die Aufgabe einzugeben und wenn man das innerhalb der 10 Sekunden nicht schafft, dann soll eine Fehler Meldung kommen und die Aufgabe neu generieren (das generieren das habe ich schon).
weiß jemand von euch wie man einen Timer in das Label schreibt?

code:
Code:
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1_1 = GUICreate("Mathetrainer v1.2.5", 433, 584, 192, 121)
GUISetBkColor(0xFFFFFF)
$Label2 = GUICtrlCreateLabel("", 16, 40, 4, 4)
$Label3 = GUICtrlCreateLabel("zahl", 16, 48, 55, 17)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label4 = GUICtrlCreateLabel("+", 72, 48, 10, 17)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label5 = GUICtrlCreateLabel("zahl", 96, 48, 47, 17)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label6 = GUICtrlCreateLabel("=", 160, 48, 26, 17)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Neue zahl generieren", 8, 80, 177, 25)
$Label1 = GUICtrlCreateLabel("Mathetrainer addieren (+)", 8, 8, 248, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Input1 = GUICtrlCreateInput("", 192, 48, 81, 21)
$Button2 = GUICtrlCreateButton("Lösung anzeigen", 192, 80, 177, 25)
$Label7 = GUICtrlCreateLabel("Lösung", 376, 88, 55, 17)
$Button3 = GUICtrlCreateButton("aufgabe checken", 280, 48, 89, 25)
$Label8 = GUICtrlCreateLabel("Mathetrainer Subtrahieren (-)", 8, 152, 274, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Label9 = GUICtrlCreateLabel("_____________________________________________________________________", 0, 112, 418, 17)
$Label10 = GUICtrlCreateLabel("Zahl", 16, 192, 51, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label11 = GUICtrlCreateLabel("-", 72, 192, 9, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label12 = GUICtrlCreateLabel("Zahl", 88, 192, 51, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label13 = GUICtrlCreateLabel("=", 152, 192, 13, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Input2 = GUICtrlCreateInput("", 192, 192, 81, 21)
$Button4 = GUICtrlCreateButton("Aufgabe checken", 280, 192, 91, 25)
$Button5 = GUICtrlCreateButton("Neue Zahl generieren", 0, 224, 185, 25)
$Button6 = GUICtrlCreateButton("Lösung anzeigen", 200, 224, 169, 25)
$Label14 = GUICtrlCreateLabel("Lösung", 376, 224, 39, 17)
$Label15 = GUICtrlCreateLabel("_____________________________________________________________________", 0, 264, 418, 17)
$Label16 = GUICtrlCreateLabel("Mathetrainer multiplizieren (*)", 0, 304, 354, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Label17 = GUICtrlCreateLabel("Zahl", 8, 344, 35, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label18 = GUICtrlCreateLabel("*", 72, 344, 10, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label19 = GUICtrlCreateLabel("Zahl", 88, 344, 59, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label20 = GUICtrlCreateLabel("=", 152, 344, 13, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Input3 = GUICtrlCreateInput("", 192, 344, 81, 21)
$Button7 = GUICtrlCreateButton("Aufgabe Checken", 280, 344, 97, 25)
$Button8 = GUICtrlCreateButton("Neue Zahl generieren", 0, 376, 193, 25)
$Button9 = GUICtrlCreateButton("Lösung anzeigen", 208, 376, 169, 25)
$Label21 = GUICtrlCreateLabel("Lösung", 384, 376, 39, 17)
$Label22 = GUICtrlCreateLabel("____________________________________________________________________", 0, 416, 412, 17)
$Label23 = GUICtrlCreateLabel("Mathetrainer Dividieren (/)", 0, 456, 252, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$Label24 = GUICtrlCreateLabel("Zahl", 16, 496, 35, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label25 = GUICtrlCreateLabel("/", 80, 496, 8, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label26 = GUICtrlCreateLabel("Zahl", 96, 496, 35, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Label27 = GUICtrlCreateLabel("=", 152, 496, 13, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Input4 = GUICtrlCreateInput("", 192, 496, 81, 21)
$Button10 = GUICtrlCreateButton("Aufgabe checken", 280, 496, 97, 25)
$Button11 = GUICtrlCreateButton("Lösung anzeigen", 208, 520, 169, 25)
$Button12 = GUICtrlCreateButton("Neue Zahl generieren", 0, 520, 193, 25)
$Label28 = GUICtrlCreateLabel("Lösung", 384, 528, 39, 17)
$Label29 = GUICtrlCreateLabel("© Copyright by TimmLanHD", 8, 552, 199, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
MsgBox(0,"Info","Generieren sie zuerst eine Zahl und klicken wenn es notwendig, ist auf Lösung anzeigen",3)

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


		Case $Button8;3 zahl generieren
	$randomzahl1 = randomzahl1() ;Zahl generieren
			GUICtrlSetData($Label17, $randomzahl1)
			$randomzahl1 = randomzahl1()
			GUICtrlSetData($Label19, $randomzahl1)


		Case $Button1;1zahl generieren

			$randomzahl1 = randomzahl1() ;Zahl generieren
			GUICtrlSetData($Label5, $randomzahl1)
			$randomzahl1 = randomzahl1()
			GUICtrlSetData($Label3, $randomzahl1)

		Case $Button4;2 geschriebenes checken
				If Not GUICtrlRead($Input2, GUICtrlRead($Label10) - GUICtrlRead($Label12)) Then
				MsgBox(0, "Fehler", "Streng dein kopf mehr an ;-)")
			EndIf


		Case $Button5;2 zahl generieren
			$randomzahl1 = randomzahl1() ;Zahl generieren
			GUICtrlSetData($Label10, $randomzahl1)
			$randomzahl1 = randomzahl1()
			GUICtrlSetData($Label12, $randomzahl1)

		Case $Button6;2 zusammenrechnen
			GUICtrlSetData($Label14 , GUICtrlRead($Label10) - GUICtrlRead($Label12)) ;zusammenrechnen

		Case $Button2;1 zusammenrechnen
			GUICtrlSetData($Label7, GUICtrlRead($Label3) + GUICtrlRead($Label5)) ;zusammenrechnen

		Case $Button3;1 geschriebenes checken
			If Not GUICtrlRead($Input1, GUICtrlRead($Label3) + GUICtrlRead($Label5)) Then
				MsgBox(0, "Fehler", "Streng dein kopf mehr an ;-)")
			EndIf



		Case $Button7;3 geschriebenes checken
			If Not GUICtrlRead($Input3, GUICtrlRead($Label17) - GUICtrlRead($Label19)) Then
				MsgBox(0, "Fehler", "Streng dein kopf mehr an ;-)")
			EndIf

		Case $Button9;3 zusammenrechnen
			GUICtrlSetData($Label21, GUICtrlRead($Label17) * GUICtrlRead($Label19)) ;zusammenrechnen
		Case $Button12;4 Zahl generieren

			$randomzahl2 = randomzahl2() ;Zahl generieren
			GUICtrlSetData($Label24, $randomzahl2)
			$randomzahl2 = randomzahl2()
			GUICtrlSetData($Label26, $randomzahl2)




		Case $Button11;4 zusammenrechnen

			GUICtrlSetData($Label28, GUICtrlRead($Label24) / GUICtrlRead($Label26)) ;zusammenrechnen


		Case $Button10;3 geschriebenes checken
			If Not GUICtrlRead($Input3, GUICtrlRead($Label24) - GUICtrlRead($Label26)) Then
				MsgBox(0, "Fehler", "Streng dein kopf mehr an ;-)")
			EndIf
	EndSwitch
WEnd




Func randomzahl1()
	Return Random(1, 100, 1)
EndFunc


Func randomzahl2()
	Return Random(1, 20, 1)
EndFunc
lg lufl
Lufl is offline  
Old 06/23/2012, 15:36   #2


 
Lawliet's Avatar
 
elite*gold: 2
Join Date: Jul 2009
Posts: 14,456
Received Thanks: 4,685
Code:
$timestamp = $TimerInit()
Und dann so abfragen, ob breits 10 Sekunden vergangen sind:

Code:
If TimerDiff($timestamp) >= 10000 then _Generiere()
Ich hab mir dein Script jetzt nicht angeschaut, aber die Zeit kannst du so in einem Label ausgeben:

Code:
GuiCtrlSetData($DeinLabel, Round($TimerDiff($timestamp)/1000, 2))
<- /1000 damit alles in Sekunden ausgegeben wird. Round fürs runden auf 2 Kommastellen.
Lawliet is offline  
Thanks
1 User
Old 06/24/2012, 12:28   #3
 
elite*gold: 0
Join Date: Nov 2010
Posts: 71
Received Thanks: 5
Okay, danke erstmal für die antwort.
aber jetzt mein problem:
wie soll ich den func machen ?
also für $timerdiif und $timestamp? und $timerinit?
ich check gerade garnichts mehr.
Lufl is offline  
Old 06/24/2012, 12:37   #4


 
Lawliet's Avatar
 
elite*gold: 2
Join Date: Jul 2009
Posts: 14,456
Received Thanks: 4,685
$timestamp ist die Variable in welcher der Timestamp ("Zeitstempel") gespeichert wird. Mit TimerInit() erstellt man diesen Timestamp und TimerDiff() misst man die Zeit, die seit dem erstellen des Timestamp vergangen ist.
Ich baue generell nicht alles in den Code ein. Du hast jetzt eig. alle Infos bekommen, die du brauchst.
Lawliet is offline  
Old 06/24/2012, 13:13   #5
 
elite*gold: 0
Join Date: Nov 2010
Posts: 71
Received Thanks: 5
mhhh kapier ich immer noch nicht..würdest du das machen wenn ich die 20 elitegold überweise?
Lufl is offline  
Old 06/24/2012, 17:04   #6

 
Njahs's Avatar
 
elite*gold: 574
Join Date: Nov 2010
Posts: 2,498
Received Thanks: 726
Njahs is offline  
Reply


Similar Threads Similar Threads
Transparent Label
12/07/2011 - AutoIt - 4 Replies
Hey Leute, schnelle frage, wie kann ich in AutoIt ein Label transparent machen, damit man nur die Zeichen sieht, und der Hintergrund durchscheint? Sufu hat nichts ergeben...zumindestens nix hilfreiches! Danke schonmal im Vorfeld! Liebe Grüße *scarface*
Tooltip auf Label
10/22/2011 - AutoIt - 7 Replies
Hallo Epvp... Ich wollte mal fragen , ob man ein Tooltip erstellen kann , dass nur erscheint , wenn die Maus auf einem BEstimmtem Label zeigt / steht..... Danke :D
Job Timer (Taxi Timer, etc)
09/01/2011 - SRO Hacks, Bots, Cheats & Exploits - 2 Replies
A small utility to keep track of jobs that need timing. http://img834.imageshack.us/img834/6076/jt01.png Always read the changelog! To get access to Job Timer, register at "www.error- soft.net" ( without the spaces between the - ) Press thanks if this helps at all.
Label aktualisieren
04/21/2010 - AutoIt - 11 Replies
Hallo leute , ich möchte mein Leben in einem online Spiel in mienem Gui anzeigen. Ich lese die Momory aus und dann zeigt er das an aber wenn sich dieser Wert ändert zeigt er es den unveränderten Wert an. Also möchte ich es jede halbesekunde oder so aktualiesieren lassen. wie mache ich das ?
Run - Label?
02/22/2010 - GW Bots - 3 Replies
Hallo an alle Pvpers, Ich hab in meiner GUI ein Label dass anzeigen soll wieviele Runs bisher gemacht wurden. Dies soll immer erneuert werden nachdem "/resign" eingegeben wurde. ICh dachte schon an: Funktioniert aber nich. Oder was ich mir auch noch gedacht habe war: Kann mir jmd helfen?



All times are GMT +1. The time now is 11:08.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.