Skocz do zawartoś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

Rekomendowane odpowiedzi

Opublikowano

<============== Początek reklamy

<

<

<

<

<

<

<

<

<

<

<

<

<

<

<============== Koniec reklamy

Witam! Prosiłbym o pomoc z przyciskiem "Finish". Miałby on zapisywać dane z pól do pliku txt i potem zamykać program.

Oto kod:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\users\l412\desktop\siema.kxf
$Siema = GUICreate("Menu główne", 572, 366, 188, 123)
GUISetCursor (2)
$Menu_1 = GUICtrlCreateLabel("Menu", 232, 0, 112, 56)
GUICtrlSetFont(-1, 34, 400, 0, "MS Sans Serif")
$Imie_1 = GUICtrlCreateLabel("Name:", 8, 64, 53, 24)
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
$Imie = GUICtrlCreateInput("", 64, 64, 201, 21)
$Nazwisko_1 = GUICtrlCreateLabel("Surname:", 8, 88, 76, 24)
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
$Nazwisko = GUICtrlCreateInput("", 88, 88, 177, 21)
$Wiek_1 = GUICtrlCreateLabel("Date of Birth:", 8, 112, 103, 24)
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
$Wiek = GUICtrlCreateInput("", 152, 112, 25, 21)
$Pesel_1 = GUICtrlCreateLabel("Pesel:", 8, 136, 51, 24)
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
$Pesel = GUICtrlCreateInput("", 64, 136, 161, 21)
$Kraj_1 = GUICtrlCreateLabel("Country:", 8, 160, 67, 24)
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
$Miasto_1 = GUICtrlCreateLabel("City:", 8, 224, 38, 24)
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
$Miasto = GUICtrlCreateInput("", 48, 224, 209, 21)
$Countries = GUICtrlCreateList("", 80, 160, 121, 58)
GUICtrlSetData(-1, "Afghanistan|Albania|Algeria|Andorra|Angola|Antigua and Barduba|Argentina|Armenia|Australia|Austria|Azerbaijan|Bahamas|Bahrain|Bangladesh|Barbados|Belarus|Belgium|Belize|Benin|Bhutan|Bolivia|Bosnia and Herzegovina|Botswana|Brazil|Brunei|Bulgaria|Burkina|Burma|Burundi|Cambodia|Cameroon|Canada|Cape Verde|Central African Republic|Chad|Chile|China|Colombia|Comoros|Congo, Democratic Republic|Congo, Republik|Costa Rica|Croatia|Cuba|Cyprus|Czech Republic|Denmark|Djibouti|Dominica|Dominican Republic|East Timor|Ecuador|Egypt|El- Salvador|Equatorial Guinea|Eritrea|Estonia|Ethiopia|Fiji|Finland|France|Gabon|Gambia|Georgia|Germany|Ghana|Greece|Grenada|Guatemala|Guinea|Guinea-Bissau|Guyana|Haiti|Honduras|Hungary|Iceland|India|Indonesia|Iran|Iraq|Ireland|Israel|Italy|Ivory|Jamaica|Japan|Jordan|Kazakhstan|Kenya|Kiribati|Korea-North|Korea-South|Kosovo|Kuwait|Kyrgyzstan|Laos|Latvia|Lebanon|Lesotho|Liberia|Libya|Liechtenstein|Lithuania|Luxembourg|Macedonia|Madagascar|Malawi|Malaysia|Maldives|Mali|Malta|Marshall Islands|Mauritania|Mauritius|Mexico|Micronesia|Moldova|Monaco|Mongolia|Montenegro|Morocco|Mozambique|Myanmar|Nagorno|Namibia|Nauru|Nepal|Netherlands|New Zealand|Nicaragua|NIger|Nigeria|Norway|Oman|Pakistan|Palau|Palestine|Panama|Papua-New Guinea|Paraguay|Peru|Philippines|Poland|Portugal|Qatar|Romania|Russia|Rwanda|Saint Kitts and Nevis|Saint Lucia|Saint Vincent and the Grenandines|Samoa|San Marino|Sao Tome and Principe|Saudi|Senegal|Serbia|Seychelles|Sierra Leone|Singapore|Slovakia|Slovenia|Solomon Islands|Somalia|South Africa|South Sudan|Spain|Sri Lanka|Sudan|Suriname|Swaziland|Sweden|Switzerland|Syria|Tajikistan|Tanzania|Thailnad|Togo|Tonga|Trinihad and Tobago|Tunisia|Turkey|Turkmenistan|Tuvalu|Uganda|Ukraine|United Arab Emirates|United Kingdom|United States|Uruguay|Uzbekistan|Vanuatu|Vatican City|Venezulea|Vietnam|Yemen|Zambia|Zimbabwe")
$Zipcode_1 = GUICtrlCreateLabel("Zip code:", 8, 248, 71, 24)
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
$Address_1 = GUICtrlCreateLabel("Address:", 8, 272, 71, 24)
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
$Address = GUICtrlCreateInput("", 80, 272, 177, 21)
$Finish = GUICtrlCreateButton("Finish", 8, 336, 75, 25)
$Date = GUICtrlCreateLabel("DD:", 112, 112, 35, 24)
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
$Month = GUICtrlCreateLabel("MM:", 192, 112, 37, 24)
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
$MM = GUICtrlCreateInput("", 232, 112, 25, 21)
$Year = GUICtrlCreateLabel("YY:", 272, 112, 29, 24)
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
$YY = GUICtrlCreateInput("", 304, 112, 33, 21)
$xx = GUICtrlCreateInput("", 80, 248, 25, 21)
$Pause = GUICtrlCreateLabel("-", 112, 248, 10, 24)
GUICtrlSetFont(-1, 13, 400, 0, "MS Sans Serif")
$XXX = GUICtrlCreateInput("", 128, 248, 41, 21)
$Terms = GUICtrlCreateRadio("I accept the terms and agree to the processing of my personal data by S_K IT Corporation :P.", 8, 304, 561, 33)
GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

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

		Case $Siema
		Case $Countries
		Case $Finish
			Exit
	EndSwitch
WEnd
Opublikowano

Najprostsza metoda to wrzucić uchwyty do inputów do tablicy, a potem pętlą odczytać je i wrzucić do pliku.

 

Przykład:

Local $txt[n]
$txt[0] = GuiCtrlCreateInput(...)
...
$txt[n] = GUICtrlCreateInput(...)

Func dopliku()
$hFile = FileOpen("labele.txt", 10) ;możesz zmienić flagę jak ci taka nie będzie pasować, tworzenie pliku + zapis z usunięciem poprzedniej zawartości
for $i = 0 to UBound($txt)-1 step +1
FileWrite($hFile, GUICtrlRead($label[$i])&@CRLF)
next
FileClose($hFile)
EndFunc

+/- powinno działać, piszę spod palca więc głowy nie dam sobie obciąć

846331404756772371599.jpeg
Opublikowano

Phoenix_PL możesz wstawić ten Twój kod do tego kodu co podałem w pytaniu? Próbowałem go wstawiać i przerabiać , działa tylko po kliknięciu i wywala mi error ,ale plik labele został stworzony. Proszę o wyrozumiałość ,bo jestem zielony w AutoIt.  ;)

Opublikowano

Stwórz tablicę o wielkości takiej, jaką masz liczbę inputów o nazwie np $inputs i za zmienne $Input1 itp. powstawiaj zmienne od $inputs[0] do $inputs[liczbainputów-1]. A potem przejedź funkcją którą podałem.

 

Pokaż twój kod i podaj error.

846331404756772371599.jpeg

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...