Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > AutoIt
You last visited: Today at 14:20

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

Advertisement



Speichern???

Discussion on Speichern??? within the AutoIt forum part of the Coders Den category.

Reply
 
Old   #1
 
ooOPhoenixXxx's Avatar
 
elite*gold: 0
Join Date: Jul 2010
Posts: 19
Received Thanks: 23
Speichern???

Hey Leute,

Also ich möchte als aller erstes anmerken das ich was AutoIt angeht noch Anfänger bin also tut mir den gefallen und verschont mich mit Fach bla bla .

also nun aber zu meinem eigentlichen Problem:

Stellen wir uns mal vor wir hätten eine GUI mit einem Label, Einem Input feld und einem Button:
Code:
[COLOR="Magenta"]#include[/COLOR] [COLOR="Gray"]<GUIConstants.au3>[/COLOR]

[COLOR="Purple"]#Region ### START Koda GUI section ### Form=[/COLOR]
[COLOR="Red"]$Form1 =[/COLOR] [COLOR="blue"]GUICreate[/COLOR][COLOR="Red"]([/COLOR][COLOR="Gray"]"Form1"[/COLOR][COLOR="red"],[/COLOR] [COLOR="Purple"]174[/COLOR][COLOR="red"],[/COLOR] [COLOR="purple"]134[/COLOR][COLOR="red"],[/COLOR] [COLOR="purple"]193[/COLOR] [COLOR="red"],[/COLOR] [COLOR="purple"]125[/COLOR][COLOR="red"])[/COLOR]
[COLOR="red"]$Input1 =[/COLOR] [COLOR="blue"]GUICtrlCreateInput[/COLOR][COLOR="Red"]([/COLOR][COLOR="Gray"]"Eingabe"[/COLOR][COLOR="red"],[/COLOR] [COLOR="purple"]24[/COLOR][COLOR="red"],[/COLOR] [COLOR="purple"]72[/COLOR][COLOR="red"],[/COLOR] [COLOR="purple"]121[/COLOR][COLOR="red"],[/COLOR] [COLOR="Purple"]21[/COLOR][COLOR="red"])[/COLOR]
[COLOR="red"]$Button1 =[/COLOR] [COLOR="blue"]GUICtrlCreateButton[/COLOR][COLOR="Red"]([/COLOR][COLOR="Gray"]"OK!"[/COLOR][COLOR="Red"],[/COLOR] [COLOR="purple"]48[/COLOR][COLOR="red"],[/COLOR] [COLOR="purple"]96[/COLOR][COLOR="red"],[/COLOR] [COLOR="purple"]75[/COLOR][COLOR="red"],[/COLOR] [COLOR="purple"]25[/COLOR][COLOR="red"],[/COLOR] [COLOR="Purple"]0[/COLOR][COLOR="red"])[/COLOR]
[COLOR="red"]$Label1 =[/COLOR] [COLOR="Blue"]GUICtrlCreateLabel[/COLOR][COLOR="Red"]([/COLOR][COLOR="Gray"]"Text"[/COLOR][COLOR="red"],[/COLOR] [COLOR="purple"]24[/COLOR][COLOR="red"],[/COLOR] [COLOR="purple"]8[/COLOR][COLOR="red"],[/COLOR] [COLOR="purple"]116[/COLOR][COLOR="red"],[/COLOR] [COLOR="Purple"]57[/COLOR][COLOR="red"])[/COLOR]
[COLOR="Blue"]GUISetState[/COLOR][COLOR="Red"]([/COLOR][COLOR="Magenta"]@SW_SHOW[/COLOR][COLOR="red"])[/COLOR]
[COLOR="Purple"]#EndRegion ### END Koda GUI section ###[/COLOR]

[COLOR="Blue"]While[/COLOR] [COLOR="Purple"]1[/COLOR]
	[COLOR="Red"]$nMsg =[/COLOR] [COLOR="Blue"]GUIGetMsg[/COLOR][COLOR="Red"]()[/COLOR]
	[COLOR="Blue"]Switch[/COLOR] [COLOR="Red"]$nMsg[/COLOR]
		[COLOR="Blue"]Case[/COLOR] [COLOR="Red"]$GUI_EVENT_CLOSE[/COLOR]
			[COLOR="Blue"]Exit[/COLOR]

	[COLOR="blue"]EndSwitch[/COLOR]
[COLOR="blue"]WEnd[/COLOR]
wie bekomme ich dann die 2 folgenden Funktionen hin?:

1. wenn ich in das Inputfeld etwas rein schreibe und auf den Button Drücke
soll im Label das stehen was ich vorher im Inputfeld eingegeben hatte.

2. wenn ich die GUI beende und neu starte soll trotz des Neustarts im
Inputfeld noch das stehen was ich zuvor eingegeben hatte (also wie die
Settings bei einem Game)

Ich bedanke mich schon mal im voraus bei euch
MfG: ooOPhoenixXxx
ooOPhoenixXxx is offline  
Old 08/01/2010, 20:27   #2
 
bladerofdarknes's Avatar
 
elite*gold: 0
Join Date: Mar 2008
Posts: 1,524
Received Thanks: 285
kann dir nur mein tutorial ans herzen legen:

bladerofdarknes is offline  
Thanks
1 User
Old 08/01/2010, 20:29   #3
 
HardCore.1337's Avatar
 
elite*gold: 1
Join Date: Feb 2009
Posts: 1,726
Received Thanks: 729
1)
PHP Code:
GUICtrlSetData($Label1$Variable_aus_InputBox
2)Sch dir dazu INI Write und INI Read an.
HardCore.1337 is offline  
Thanks
1 User
Old 08/01/2010, 21:02   #4
 
ooOPhoenixXxx's Avatar
 
elite*gold: 0
Join Date: Jul 2010
Posts: 19
Received Thanks: 23
ok ich hab mich jetzt einfach mal an das TuT gehalten und der Code sieht jetzt so aus:

Code:
#include <GUIConstants.au3>


$text1=IniRead("Label.ini","texte","Read", "")


#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 174, 134, 193 , 125)
$Input1 = GUICtrlCreateInput("Eingabe", 24, 72, 121, 21)
$Button1 = GUICtrlCreateButton("OK!", 48, 96, 75, 25, 0)
$Label1 = GUICtrlCreateLabel($text1, 24, 8, 116, 57)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###





While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            call("test")
    EndSwitch
WEnd


func test()
	$read1=GUICtrlRead($Input1)
	iniwrite("Label.ini","texte","Read", $read1)
EndFunc
das Ärgerliche ist nur das man erst das Script neu starten muss damit die veränderte ini neu ausgelesen wird. hab schon versucht es in eine Funktion zu packen und diese nach dem ändern der ini neu aufzurufen aber ... naja das geht net.

habt ihr ne Lösung dafür?
ooOPhoenixXxx is offline  
Old 08/01/2010, 21:52   #5
 
bladerofdarknes's Avatar
 
elite*gold: 0
Join Date: Mar 2008
Posts: 1,524
Received Thanks: 285
mach es so wie hardcore es sagte:
GUICtrlSetData($Label1, $Variable_aus_InputBox)
und stadt $Variable_aus_InputBox
GUICtrlSetData($Label1, IniRead("Label.ini","texte","Read", $read1))
sollte so gehen bin gerade nicht zu hause
also zuerst in der ini speichern dann lesen lassen
bladerofdarknes is offline  
Thanks
1 User
Old 08/01/2010, 22:15   #6
 
PenGuin :O's Avatar
 
elite*gold: 2
Join Date: Mar 2008
Posts: 1,778
Received Thanks: 1,222
Btw brauchst du kein "Call" Befehl um die Funktionen aufzurufen...

In deinem Fall reicht ein einfaches "test()"

Könnte dir auch noch MySQL nennen, ist aber etwas schwieriger, für deinen Zweck reicht Inis.

Und zusätzlich schau dir AdlibRegister an.
Du schreibst eine Funktion, die Inis ausliest und bei Veränderungen das geschriebene übernimmt...
PenGuin :O is offline  
Thanks
1 User
Old 08/01/2010, 22:16   #7
 
ooOPhoenixXxx's Avatar
 
elite*gold: 0
Join Date: Jul 2010
Posts: 19
Received Thanks: 23
@bladerofdarknes:

also wenn du das jetzt so meinst:

Code:
#include <GUIConstants.au3>


#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 174, 134, 193 , 125)
$Input1 = GUICtrlCreateInput("Eingabe", 24, 72, 121, 21)
$Button1 = GUICtrlCreateButton("OK!", 48, 96, 75, 25, 0)
$Label1 = GUICtrlCreateLabel("", 24, 8, 116, 57)
GUICtrlSetData($Label1, IniRead("Label.ini","texte","Read", ""))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###





While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            call("test")
    EndSwitch
WEnd


func test()
	$read1=GUICtrlRead($Input1)
	iniwrite("Label.ini","texte","Read", $read1)
EndFunc
dann is das problem geblieben...
wenn ich das aber anders machen sollte (was warscheinlich der fall ist) musst du mir das nochmal für dumme erklären
ooOPhoenixXxx is offline  
Old 08/01/2010, 22:24   #8
 
PenGuin :O's Avatar
 
elite*gold: 2
Join Date: Mar 2008
Posts: 1,778
Received Thanks: 1,222
Schau dir mal meinen Post an.
PenGuin :O is offline  
Thanks
1 User
Old 08/01/2010, 22:26   #9
 
Shadow992's Avatar
 
elite*gold: 77
Join Date: May 2008
Posts: 5,430
Received Thanks: 5,878
Quote:
Originally Posted by ooOPhoenixXxx View Post
@bladerofdarknes:

also wenn du das jetzt so meinst:

Code:
#include <GUIConstants.au3>


#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 174, 134, 193 , 125)
$Input1 = GUICtrlCreateInput("Eingabe", 24, 72, 121, 21)
$Button1 = GUICtrlCreateButton("OK!", 48, 96, 75, 25, 0)
$Label1 = GUICtrlCreateLabel("", 24, 8, 116, 57)
GUICtrlSetData($Label1, IniRead("Label.ini","texte","Read", ""))
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###





While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            call("test")
    EndSwitch
WEnd


func test()
	$read1=GUICtrlRead($Input1)
	iniwrite("Label.ini","texte","Read", $read1)
EndFunc
dann is das problem geblieben...
wenn ich das aber anders machen sollte (was warscheinlich der fall ist) musst du mir das nochmal für dumme erklären
Allzuviele Abfragen kannst du da aber nicht machen, AutoIt ist dafür einfach zu langsam:
PHP Code:
#include <GUIConstants.au3>

$FileRead=0

#Region ### START Koda GUI section ### Form=
$Form1 GUICreate("Form1"174134193 125)
$Input1 GUICtrlCreateInput("Eingabe"247212121)
$Button1 GUICtrlCreateButton("OK!"489675250)
$Label1 GUICtrlCreateLabel(""24811657)
$FileRead=IniRead("Label.ini","texte","Read""")
GUICtrlSetData($Label1$FileRead)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###





While 1
    $nMsg 
GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit
        Case 
$Button1
            call
("test")
    EndSwitch
    if 
$FileRead<>IniRead("Label.ini","texte","Read""")then
    $FileRead
=IniRead("Label.ini","texte","Read""")
    
GUICtrlSetData($Label1$FileRead)
    EndIf
WEnd


func test
()
    
$read1=GUICtrlRead($Input1)
    
iniwrite("Label.ini","texte","Read"$read1)
EndFunc 
Shadow992 is offline  
Thanks
1 User
Old 08/01/2010, 22:34   #10
 
ooOPhoenixXxx's Avatar
 
elite*gold: 0
Join Date: Jul 2010
Posts: 19
Received Thanks: 23
puh... also:
@Pinguin94:
AdlibRegister is ne feine sache (ich versteh den befehl zwar nicht so ganz... aber nicht so wichtig jedenfalls funktioniert´s damit.)

@Shadow992:
funzt ebenfalls super (hier versteh ich zwar die zusammenhänge nicht ganz... muss ich aber auch zum glück nicht alles was ich brauch hab ich ja jetzt ^^)

Thx @All
ooOPhoenixXxx is offline  
Old 08/01/2010, 23:55   #11
 
PenGuin :O's Avatar
 
elite*gold: 2
Join Date: Mar 2008
Posts: 1,778
Received Thanks: 1,222
Er liest einfach dauerhaft die Ini aus, und wenn sich ein Eintrag geändert hat, setz er ihn in den Input.

AdlibRegister macht das ganze nur schöner, da dort die Hauptschleife nicht so stark belastet wird, wobei das hier egal ist, da sowieso kaum etwas in der Hautpschleife steht...
PenGuin :O is offline  
Thanks
1 User
Old 08/03/2010, 13:39   #12
 
ooOPhoenixXxx's Avatar
 
elite*gold: 0
Join Date: Jul 2010
Posts: 19
Received Thanks: 23
xD versteh das jetzt Bitte nicht falsch aber so weit war ich auch schon naja trotzdem danke fürs erklären
ooOPhoenixXxx is offline  
Reply


Similar Threads Similar Threads
[How to]NPC´s auf der Map Speichern!
02/07/2010 - Metin2 PServer Guides & Strategies - 28 Replies
#delete
[Maps Speichern] Wie kann ich Maps speichern?
10/22/2009 - Metin2 Private Server - 37 Replies
Hey Com, ich wollte gern mal wissen, wie ich eine map speichern kann? Ich verstehe das hier nicht: http://img8.imageshack.us/img8/1862/33332332323325 5.jpg Was muss ich wo rein schreiben: Als Beisp. Wenn ich nun Map1 Rotes Reich wäre was müsste ich das rein schreiben damit die Map mit allen neuen zB NPC gespeichert wird?
How To Npc auf Map Speichern
10/21/2009 - Metin2 - 5 Replies
Wie "speicher" ich npcs auf ner map das sie also nach restatart immer noch da sind?



All times are GMT +1. The time now is 14:21.


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.