Wie kann ich in AutoIt eine ganz einfache Stoppuhr coden .. ?
Global $i = 0
While True
$i +=1
$keyname = RegEnumKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\", $i)
If @error Then ExitLoop
$result = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & $keyname, "DisplayName")
If $result = "S4 League_EU" Then
$s4path = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & $keyname, "InstallLocation")
ExitLoop
EndIf
WEnd
ShellExecute($s4path & "\patcher_s4.exe", "", $s4path)
#RequireAdmin
#include <GUIConstants.au3>
$gui1 = GUICreate("Run S4 Patcher", 350, 70, 193, 125)
$path = GUICtrlCreateInput("", 8, 8, 329, 27)
$getpath = GUICtrlCreateButton("Path", 8, 41, 56, 27, 0)
$start = GUICtrlCreateButton("Start", 84, 41, 56, 27, 0)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $getpath
path()
Case $start
start()
EndSwitch
WEnd
Func path()
Global $i = 0
While True
$i +=1
$keyname = RegEnumKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\", $i)
If @error Then ExitLoop
$result = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & $keyname, "DisplayName")
If $result = "S4 League_EU" Then
$s4path = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" & $keyname, "InstallLocation")
ExitLoop
EndIf
WEnd
GUICtrlSetData( $path, $s4path)
EndFunc
Func start()
$s4path = GUICtrlRead($path)
ShellExecute($s4path & "\patcher_s4.exe", "", $s4path)
EndFunc
Ja, denk nichmal daran nen Auto-Login zu machen xDQuote:
THX ;)
€dit: Weist du noch was nützliches für mein Tool ?
WinWait("S4 League Game Launcher")
ControlClick("S4 League Game Launcher", "", "[CLASS:Button; INSTANCE:2]")
$time = GUICtrlRead($input) Do $time -1 Sleep(6000) Until $time = 0
Schau auf meinen Edit xDQuote:
xDDD Das erste was du gepostet hast hat gleich gefunzt xDD
#RequireAdmin
#include <GUIConstants.au3>
$gui1 = GUICreate("Run S4 Patcher", 350, 70, 193, 125)
$zahl = GUICtrlCreateInput("How long? (Seconds)", 8, 8, 329, 27)
$start = GUICtrlCreateButton("Start", 8, 41, 56, 27, 0)
$zahl2 = GUICtrlCreateLabel("0",90, 41,56,27)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $start
start()
EndSwitch
WEnd
Func start()
$time = 0
Do
Sleep(1000)
$time = $time + 1
GUICtrlSetData($zahl2, $time)
Until
$time = GUICtrlRead($input)
EndFunc
#RequireAdmin
#include <GUIConstants.au3>
$gui1 = GUICreate("Timer", 100, 70, 193, 125)
$stop = GUICtrlCreateButton("Stop", 8, 8, 56, 27,0)
$start = GUICtrlCreateButton("Start", 8, 41, 56, 27, 0)
$zahl = GUICtrlCreateLabel("0",80, 30,56,27)
GUISetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
Switch $msg
Case $GUI_EVENT_CLOSE
GUIDelete()
Exit
Case $start
start()
Case $stop
stop()
EndSwitch
WEnd
Func start()
$time = 0
While 1
Sleep(1000)
$time += 1
GUICtrlSetData($zahl, $time)
WEnd
EndFunc
Func stop() ;Funktioniert nicht
While 1
Sleep(1)
WEnd
EndFunc
Du solltest es mit TimeStamps machen :Quote:
Genau ;) Und ja dazu stehe ich.
1. Ich bin en blutiger AutoIt Anfänger
2.Wenn ichs einbauen solte geht nur das ganze Tool kaputt
3.Ich bin doof :awesome:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 270, 93, 192, 124)
GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close")
$Button1 = GUICtrlCreateButton("Start", 8, 8, 129, 41, $WS_GROUP)
GUICtrlSetOnEvent(-1, "Button1Click")
$Button2 = GUICtrlCreateButton("Stopp", 144, 8, 121, 41, $WS_GROUP)
GUICtrlSetOnEvent(-1, "Button2Click")
$Label1 = GUICtrlCreateLabel("...", 16, 64, 236, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$timer=0
$start=0
While 1
Sleep(100)
If $start=1 Then
$diff=Int(TimerDiff($timer)/1000)
GUICtrlSetData($Label1,"Vergangegen Zeit : "&ConvertSecToTime($diff))
EndIf
WEnd
Func Button1Click()
$timer=TimerInit()
$start=1
EndFunc
Func Button2Click()
$start=0
$diff=Int(TimerDiff($timer)/1000)
GUICtrlSetData($Label1,"Vergangegen Zeit : "&ConvertSecToTime($diff))
EndFunc
Func Form1Close()
Exit
EndFunc
Func ConvertSecToTime($oSec)
Local $zeit[3]
$zeit[0] = Int($oSec / 60) ;min
$zeit[1] = Mod($oSec, 60) ;sec
If $zeit[0] >= 60 Then ;hour
$zeit[2] = Int($zeit[0] / 60) ;hour
If $zeit[2] > 0 Then $zeit[0] = Mod($zeit[0], 60)
If StringLen($zeit[0]) = 1 Then $zeit[0] = "0" & $zeit[0]
If StringLen($zeit[1]) = 1 Then $zeit[1] = "0" & $zeit[1]
If StringLen($zeit[2]) = 1 Then $zeit[2] = "0" & $zeit[2]
Return $zeit[2] & ":" & $zeit[0] & ":" & $zeit[1]
Else
If StringLen($zeit[0]) = 1 Then $zeit[0] = "0" & $zeit[0]
If StringLen($zeit[1]) = 1 Then $zeit[1] = "0" & $zeit[1]
Return $zeit[0] & ":" & $zeit[1]
EndIf
EndFunc ;==>ConvertSecToTime
#include <GUIConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("TimeBox", 226, 148, 193, 125)
$Label1 = GUICtrlCreateLabel("", 32, 24, 27, 17)
$Button1 = GUICtrlCreateButton("Button1", 48, 88, 129, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
$timestamp = TimerInit () ;initialisiert eine Timestamp die in der Variable gespeichert wird.
While 1
GuiCtrlSetData ( $Label1, TimerDiff ( $timestamp ) ) ;setzt den Text von einem GUI Objekt neu
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd