iniwrite

07/22/2009 23:17 kknb#1
steh grad irgendwie aufm schlauch, kann mir mal bitte wer sagen warum des iniwrite hier net funktioniert?

Code:
checkpath()
Func checkpath()
$path = IniRead("tt6.ini", "path", "folder", "nothing set")
	If $path = "nothing set" Or $path = "" Then
		$path1 = FileOpenDialog("please set the path to your Guild Wars executable", @ProgramFilesDir, "gw.exe (*.exe)", 1 + 2)
		If $path1 = "" Then
			MsgBox(16, "", "the bot wont work without your right guildwars dir!")
			Exit
		Else
			IniWrite("tt6.ini", "path", "folder", $path1)
			checkpath()
		EndIf
	EndIf
EndFunc
07/23/2009 14:52 felixli93#2
aus einem mir unerklärlichen grund, kannst du hier anscheinend nicht ohne ein @ScriptDir arbeiten...
Normalerweise klappt es aber seltsamerweise auch ohne das makro @scriptdir...

Code:
checkpath()
Func checkpath()
$path = IniRead("tt6.ini", "path", "folder", "nothing set")
	If $path = "nothing set" Or $path = "" Then
		$path1 = FileOpenDialog("please set the path to your Guild Wars executable", @ProgramFilesDir, "gw.exe (*)", 1 + 2)
		If $path1 = "" Then
			MsgBox(16, "", "the bot wont work without your right guildwars dir!")
			Exit
		Else
			IniWrite([COLOR="Red"]@ScriptDir &[/COLOR] "\tt6.ini", "path", "folder", $path1)
			checkpath()
		EndIf
	EndIf
EndFunc
mfg felixli93

EDIT:
mir ist soeben aufgefallen, dass der bot die .ini seltsamerweise in dem ordner erstellt, den man bei FileOpenDialog ausgewählt hat.
Warum auch immer...

EDIT²:
definiert man $path1 ohne den FileOpenDialog, dann gibt es keine Probleme, benutzt man jedoch FileOpenDialog für $path1, so funktioniert die IniWrite nicht mehr richtig und die datei wird bei nicht angegebenem ordner in dem Ordner erstellt, in der die Datei war, die man mit FileOpenDialog ausgewählt hat...
07/23/2009 18:15 kknb#3
edited.
07/23/2009 18:22 felixli93#4
sehr seltsam.
am besten wäre es, im offiziellen autoit forum nach zu fragen...
07/23/2009 18:24 kknb#5
also der fehler lag in der variablenbezeichnung. warum das ohne scriptdir nicht geht ist mir noch schleierhaft. fileopendialog startet zwar immer noch im gw ordner, aber was solls, wenigstens läufts so.

Code:
checkpath()
Func checkpath()
$path = IniRead(@ScriptDir & "\tt6.ini", "path", "folder", "nothing set")
	If $path = "nothing set" Or $path = "" Then
		$path = FileOpenDialog("please set the path to your Guild Wars executable", @ProgramFilesDir, "gw.exe (*)", 1 + 2)
		If $path = "" Then
			MsgBox(16, "", "the bot wont work without your right guildwars dir!")
			Exit
		Else
			IniWrite(@ScriptDir & "\tt6.ini", "path", "folder", $path)
			checkpath()
		EndIf
	EndIf
EndFunc
07/23/2009 18:25 felixli93#6
muss irgendwas mit FileOpenDialog zu tun haben, denn wie gesagt ohne das geht's ohne @ScriptDir...
07/23/2009 22:21 Bot_interesierter#7
FileOpenDialog wechselt das workingdirectory, steht zumindest so auf der Autoit Online Help Seite :), dann ist klar das des WriteIni nicht mehr geht
07/23/2009 22:50 felixli93#8
hmm, das erklärt dann ja alles...
is ja behindert!