Skocz do zawartości

Dołącz do społeczności!

👋 Witaj na MPCForum!

Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

  • ✅ Pełny dostęp do działów i ukrytych treści
  • ✅ Możliwość pisania i odpowiadania w tematach
  • ✅ System prywatnych wiadomości
  • ✅ Zbieranie reputacji i rozwijanie swojego profilu
  • ✅ Członkostwo w jednej z największych społeczności graczy

👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

Zarejestruj się teraz

Dlaczego To Nie Działa?

Rekomendowane odpowiedzi

Opublikowano

Dlaczego ten skrypt nie działa tak jakbym chciał / jak powinien działać?

Chciałbym żeby się wyłączył o aktualnej godzinie plus to co wpisze w inputy.

 

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <StaticConstants.au3>

HotKeySet ( "{ESC}" , "Terminate" )

$settings = "ustawienia.ini"
$czash = IniRead($settings, "Przerwy", "czash", 0)
$czasm = IniRead($settings, "Przerwy", "czasm", 0)
$m=@MIN
$h=@HOUR

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 284, 186, 192, 124)
$Input1 = GUICtrlCreateInput("h", 48, 56, 121, 21)
$Input2 = GUICtrlCreateInput("m", 72, 104, 121, 21)
$Input3 = GUICtrlCreateInput($h, 72, 500, 121, 21)
$Input4 = GUICtrlCreateInput($m, 72, 700, 121, 21)
$Button1 = GUICtrlCreateButton("Button1", 208, 160, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$tr = $Input3 + $Input1
$ty = $Input4 + $Input2

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
	Case $GUI_EVENT_CLOSE
		Exit
	Case $Button1
		save()
		ustaw()
		sleep(500)
		GUISetState(@SW_HIDE, $Form1)
		wylacz()
EndSwitch
WEnd

Func wylacz()
Do
$m=@MIN
$h=@HOUR
Sleep(30000)
Until $h = $tr And $m = $ty
Exit
EndFunc

Func save()
IniWrite($settings, "Przerwy", "czash", GUICtrlRead($Input3))
IniWrite($settings, "Przerwy", "czasm", GUICtrlRead($Input4))
EndFunc

Func ustaw()
$czash = GUICtrlRead($Input2)
$czasm = GUICtrlRead($Input3)
EndFunc

Func Terminate()
  Exit
EndFunc

 

Opublikowano

$tr = $Input3 + $Input1
$ty = $Input4 + $Input2

 

$tr = GuiCtrlRead($Input3) + GuiCtrlRead($Input1)
$ty = GuiCtrlRead($Input4) + GuiCtrlRead($Input2)

 

W tym zauważyłem błąd. Nie wiem czy teraz będzie działać, bo nie mam autoit'a na dysku.

Opublikowano
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <StaticConstants.au3>

HotKeySet("{ESC}", "Terminate")

$settings = "ustawienia.ini"
;~ $czash = IniRead($settings, "Przerwy", "czash", 0)
;~ $czasm = IniRead($settings, "Przerwy", "czasm", 0)
$czash = IniRead($settings, "Przerwy", "czas minut", "10")
$czasm = IniRead($settings, "Przerwy", "czas godzin", "20")
;~ $m = @MIN
;~ $h = @HOUR

#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 284, 186, 192, 124)
;~ $Input1 = GUICtrlCreateInput("h", 48, 56, 121, 21)
;~ $Input2 = GUICtrlCreateInput("m", 72, 104, 121, 21)
;~ $Input3 = GUICtrlCreateInput($h, 72, 500, 121, 21)  ;????
;~ $Input4 = GUICtrlCreateInput($m, 72, 700, 121, 21)  ;????
$Input1 = GUICtrlCreateInput($czash, 48, 56, 121, 21)
$Input2 = GUICtrlCreateInput($czasm, 72, 104, 121, 21)
$Button1 = GUICtrlCreateButton("Button1", 208, 160, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

;~ $tr = $Input3 + $Input1
;~ $ty = $Input4 + $Input2

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
	Case $GUI_EVENT_CLOSE
		Exit
	Case $Button1
		save()
		;ustaw()
		;Sleep(500)
		GUISetState(@SW_HIDE, $Form1)
		wylacz()
EndSwitch
sleep(20) ;<===| !!!
WEnd

;~ Func wylacz()
;~ Do
;~         $m=@MIN
;~         $h=@HOUR
;~         Sleep(30000)
;~ Until $h = $tr And $m = $ty
;~ Exit
;~ EndFunc
Func wylacz()
$za_min = GUICtrlRead($Input1)
$za_hour = GUICtrlRead($Input2)
Do
	Sleep(1000)
Until $za_min = @MIN And $za_hour = @HOUR
Exit
EndFunc   ;==>wylacz

Func save()
;~ 	IniWrite($settings, "Przerwy", "czash", GUICtrlRead($Input3))
;~ 	IniWrite($settings, "Przerwy", "czasm", GUICtrlRead($Input4))
IniWrite($settings, "Przerwy", "czas minut", GUICtrlRead($Input1))
IniWrite($settings, "Przerwy", "czas godzin", GUICtrlRead($Input2))
EndFunc   ;==>save

;~ Func ustaw()
;~         $czash = GUICtrlRead($Input2)
;~         $czasm = GUICtrlRead($Input3)
;~ EndFunc

Func Terminate()
Exit
EndFunc   ;==>Terminate

Opublikowano
  • Autor

@dziób tukana

 

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <StaticConstants.au3>

HotKeySet("{ESC}", "Terminate")

$settings = "ustawienia.ini"
;~ $czash = IniRead($settings, "Przerwy", "czash", 0)
;~ $czasm = IniRead($settings, "Przerwy", "czasm", 0)
$czash = IniRead($settings, "Przerwy", "czas minut", "10")
$czasm = IniRead($settings, "Przerwy", "czas godzin", "20")
;~ $m = @MIN
;~ $h = @HOUR

#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 284, 186, 192, 124)
;~ $Input1 = GUICtrlCreateInput("h", 48, 56, 121, 21)
;~ $Input2 = GUICtrlCreateInput("m", 72, 104, 121, 21)
;~ $Input3 = GUICtrlCreateInput($h, 72, 500, 121, 21)  ;????
;~ $Input4 = GUICtrlCreateInput($m, 72, 700, 121, 21)  ;????
$Input1 = GUICtrlCreateInput($czash, 48, 56, 121, 21)
$Input2 = GUICtrlCreateInput($czasm, 72, 104, 121, 21)
$Button1 = GUICtrlCreateButton("Button1", 208, 160, 75, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

;~ $tr = $Input3 + $Input1
;~ $ty = $Input4 + $Input2

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
	Case $GUI_EVENT_CLOSE
		Exit
	Case $Button1
		save()
		;ustaw()
		;Sleep(500)
		GUISetState(@SW_HIDE, $Form1)
		wylacz()
EndSwitch
sleep(20) ;<===| !!!
WEnd

;~ Func wylacz()
;~ Do
;~         $m=@MIN
;~         $h=@HOUR
;~         Sleep(30000)
;~ Until $h = $tr And $m = $ty
;~ Exit
;~ EndFunc
Func wylacz()
$za_min = GUICtrlRead($Input1)
$za_hour = GUICtrlRead($Input2)
Do
	Sleep(1000)
Until $za_min = @MIN And $za_hour = @HOUR
Exit
EndFunc   ;==>wylacz

Func save()
;~ 	IniWrite($settings, "Przerwy", "czash", GUICtrlRead($Input3))
;~ 	IniWrite($settings, "Przerwy", "czasm", GUICtrlRead($Input4))
IniWrite($settings, "Przerwy", "czas minut", GUICtrlRead($Input1))
IniWrite($settings, "Przerwy", "czas godzin", GUICtrlRead($Input2))
EndFunc   ;==>save

;~ Func ustaw()
;~         $czash = GUICtrlRead($Input2)
;~         $czasm = GUICtrlRead($Input3)
;~ EndFunc

Func Terminate()
Exit
EndFunc   ;==>Terminate

 

A nie dałoby rady z tym dodawaniem? Bo potem chcę to przerobić na wybór radio (każde będzie miało podporządkowaną jakąś liczbę) i w zależności jakie radio wybierzesz to skrypt wyłączy się za odpowiednią liczbę minut.Mam nadzieję, że zrozumiesz o co mi chodzi.

Edytowane przez matu691

Opublikowano
Func wylacz()
$licz_czas = TimerInit()
$za_min = GUICtrlRead($Input1)*60000 ; 60k to minuta
$za_hour = GUICtrlRead($Input2)*3600000 ; 3600k to godzina
$ile_czasu_ma_czekac = $za_min + $za_hour
Do
	Sleep(1000)
Until TimerDiff($licz_czas) >= $ile_czasu_ma_czekac
Exit
EndFunc   ;==>wylacz

ok?

Opublikowano

przykłady z forum autoita livzników czasowych

$start = @HOUR & ":" & @MIN + 2 ; tu przykład 2 minuty od załączenia 
While 1

   $start2 = @HOUR & ":" & @MIN

   If $start = $start2 Then

   ; tu wpisac co ma robic jak zadziała 

       ExitLoop
   EndIf

   ToolTip("Start Time = " & $start & @CRLF & "Real Time = " & $start2, 20, 20, "Time Machine", 1)
   Sleep(2000)

WEnd
Exit

 

$Minutes = 90 ; will wait 90 minutes

Local $60Count = 0, $begin = TimerInit()
While $Minutes > $60Count

   $dif = TimerDiff($begin)
   $dif2 = StringLeft($dif, StringInStr($dif, ".") -1)
   $Count = int($dif/1000)
   $60Count = Int($Count / 60)

   ToolTip("Minutes Required = " & $Minutes & @CRLF & "Minutes Past = " & $60Count & @CRLF & "Seconds Count = " & $Count & @CRLF & "Mili-Seconds Count = " & $dif2, 20, 20, "Time Machine #1", 1)

   Sleep(20)

WEnd

MsgBox(64, "Time-Up!!", "Your " & $Minutes & " minutes have passed    ")

If you = stupid then

insert(foot.in.your.ass)

end if

licznik-54-96732-stat.png

Opublikowano
  • Autor

Func wylacz()
$licz_czas = TimerInit()
$za_min = GUICtrlRead($Input1)*60000 ; 60k to minuta
$za_hour = GUICtrlRead($Input2)*3600000 ; 3600k to godzina
$ile_czasu_ma_czekac = $za_min + $za_hour
Do
	Sleep(1000)
Until TimerDiff($licz_czas) >= $ile_czasu_ma_czekac
Exit
EndFunc   ;==>wylacz

ok?

OK. O to mi chodziło dzięki :rolleyes: Plus.

Gość
Ten temat został zamknięty. Brak możliwości dodania odpowiedzi.

Ostatnio przeglądający 0

  • Brak zarejestrowanych użytkowników przeglądających tę stronę.

Konto

Nawigacja

Skonfiguruj powiadomienia push w przeglądarce

Chrome (Android)
  1. Stuknij ikonę kłódki obok paska adresu.
  2. Stuknij Uprawnienia → Powiadomienia.
  3. Dostosuj swoje ustawienie.
Chrome (Komputer)
  1. Kliknij ikonę kłódki na pasku adresu.
  2. Wybierz Ustawienia witryny.
  3. Znajdź Powiadomienia i dostosuj swoje ustawienie.