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

Prosty skrypt, ale nie działa

Rekomendowane odpowiedzi

Opublikowano

co teraz zjebalem?

dziala tylko do 9

 

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 276, 138, 192, 124)
$Button1 = GUICtrlCreateButton("Dodaj + 1", 88, 90, 75, 25)
$high = GUICtrlCreateLabel("0", 106, 32, 36, 17)
$cur = GUICtrlCreateLabel("0", 106, 58, 36, 17)
$m = GUICtrlCreateLabel("", 166, 58, 56, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

EndSwitch
WEnd

Func _jakas_tam_funkcja_()
$1 = GUICtrlRead($cur)
GUICtrlSetData ( $cur, $1 + 1 )
sprawdz()
EndFunc

Func sprawdz()
$1 = GUICtrlRead ( $cur )
$2 = GUICtrlRead ( $high )
If $1 >= $2 Then GUICtrlSetData ( $high, $1 )
If $1 = 10 Then GUICtrlSetData ( $m, "No i dupa " )
EndFunc

Opublikowano
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 276, 138, 192, 124)
$Button1 = GUICtrlCreateButton("Dodaj + 1", 88, 90, 75, 25)
$high = GUICtrlCreateLabel("0", 106, 32, 36, 17)
$cur = GUICtrlCreateLabel("0", 106, 58, 36, 17)
$m = GUICtrlCreateLabel("", 166, 58, 56, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

   	EndSwitch
WEnd

Func _jakas_tam_funkcja_()
   	$1 = GUICtrlRead($cur)
   	GUICtrlSetData ( $cur, $1 + 1 )
   	sprawdz()
EndFunc

Func sprawdz()
   	$1 = GUICtrlRead ( $cur )
   	$2 = GUICtrlRead ( $high )
   	GUICtrlSetData ( $high, $1 )
   	If $1 = 10 Then GUICtrlSetData ( $m, "No i działa " )
EndFunc

Edytowane przez Sopelek997

Opublikowano
  • Autor

nie, nie dziala..

$high ma zostawac na stalym poziomie, a nie zmieniac sie razem z $cur

 

ma byc tak jak tu:

 

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 277, 155, 192, 124)
$Button1 = GUICtrlCreateButton("Dodaj + 1", 88, 90, 75, 25)
$Button2 = GUICtrlCreateButton("Odejmij - 1", 88, 120, 75, 25)
$high = GUICtrlCreateLabel("0", 106, 32, 36, 17)
$cur = GUICtrlCreateLabel("0", 106, 58, 36, 17)
$m = GUICtrlCreateLabel("", 166, 58, 56, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
	Case $GUI_EVENT_CLOSE
		Exit
	Case $Button1
		_jakas_tam_funkcja_()
	Case $Button2
		_jakas_tam_funkcja_2()
EndSwitch
WEnd

Func _jakas_tam_funkcja_()
$1 = GUICtrlRead($cur)
GUICtrlSetData ( $cur, $1 + 1 )
sprawdz()
EndFunc

Func _jakas_tam_funkcja_2()
$1 = GUICtrlRead($cur)
GUICtrlSetData ( $cur, $1 - 1 )
sprawdz()
EndFunc

Func sprawdz()
$1 = GUICtrlRead ( $cur )
$2 = GUICtrlRead ( $high )
If $1 >= $2 Then GUICtrlSetData ( $high, $1 )
If $1 = 10 Then GUICtrlSetData ( $m, "No i dupa " )
EndFunc

 

dodaj i odejmij i zobaczysz o co mi chodzi ;p

Opublikowano

To pisz odrazu o co ci chodzi -.- chciales zeby dzialalo to zrobilem i dzialalo. Następpnym razem lepiej opisz problem.

 

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
global $1 = 0, $2 = 0
$Form1 = GUICreate("Form1", 277, 155, 192, 124)
$Button1 = GUICtrlCreateButton("Dodaj + 1", 88, 90, 75, 25)
$Button2 = GUICtrlCreateButton("Odejmij - 1", 88, 120, 75, 25)
$high = GUICtrlCreateLabel("0", 106, 32, 36, 17)
$cur = GUICtrlCreateLabel("0", 106, 58, 36, 17)
$m = GUICtrlCreateLabel("", 166, 58, 56, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
   	$nMsg = GUIGetMsg()
   	Switch $nMsg
           	Case $GUI_EVENT_CLOSE
                   	Exit
           	Case $Button1
                   	_jakas_tam_funkcja_()
           	Case $Button2
                   	_jakas_tam_funkcja_2()
   	EndSwitch
WEnd

Func _jakas_tam_funkcja_()
   	$1 += 1
   	GUICtrlSetData ( $cur, $1)
   	sprawdz()
EndFunc

Func _jakas_tam_funkcja_2()
		$1 -= 1
   	GUICtrlSetData ( $cur, $1)
   	;tu nie ma po co sprawdzac bo zawsze bedzie mniejsza
EndFunc

Func sprawdz()
$2 = guictrlread($high)
   	If $1 > $2 Then
	GUICtrlSetData ( $high, $1 )
endif
;~ 		If $1 = 10 Then GUICtrlSetData ( $m, "No i dupa " )
EndFunc

 

Co do tego dlaczego tamto nie działało to nie wiem dlaczego :D moze ktos lepszy by to umial rozkminic

Edytowane przez Sopelek997

Opublikowano

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
Global $a, $b
$Form1 = GUICreate("Form1", 277, 155, 192, 124)
$Button1 = GUICtrlCreateButton("Dodaj + 1", 88, 90, 75, 25)
$Button2 = GUICtrlCreateButton("Odejmij - 1", 88, 120, 75, 25)
$high = GUICtrlCreateLabel("0", 106, 32, 36, 17)
$cur = GUICtrlCreateLabel("0", 106, 58, 36, 17)
$m = GUICtrlCreateLabel("", 166, 58, 56, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
   	$nMsg = GUIGetMsg()
   	Switch $nMsg
           	Case $GUI_EVENT_CLOSE
                   	Exit
           	Case $Button1
                   	_jakas_tam_funkcja_()
           	Case $Button2
                   	_jakas_tam_funkcja_2()
   	EndSwitch
WEnd

Func _jakas_tam_funkcja_()

   	GUICtrlSetData ( $cur, GUICtrlRead($cur) + 1 )
   	sprawdz()
EndFunc

Func _jakas_tam_funkcja_2()

   	GUICtrlSetData ( $cur, GUICtrlRead($cur) - 1 )

EndFunc

Func sprawdz()
$a = GUICtrlRead($cur)
$b = GUICtrlRead($high)
   	If hex($a) > hex($ Then GUICtrlSetData($high, GUICtrlRead($cur))
   	If $a = 10 Then GUICtrlSetData ( $m, "No i dupa " )
EndFunc

 

Dodalem zeby zamienial na hexa. Teoretycznie normalnie powinien też działać, ale z niewiadomego powodu nie chce... Zamiana na hexa nic nie zmienia, a przynajmniej działa :)

Edytowane przez Sopelek997

Opublikowano

Zmiana

Func sprawdz()
       $2 = Number(GUICtrlRead ( $high ))
	$1 = Number(GUICtrlRead ( $cur ))

Wystarczy.

 

Wszystkie labela zawierają stringi. Mimo, że AutoIt operuje rzekomo na Variantach, warto dodatkowo zaznaczyć, że spodziewamy się tam liczby.

Ta sygnatura jest pusta.

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.