blessthefall Posted October 18, 2008 Posted October 18, 2008 Okay, so I'm going to try to explain this as well as can: I want to have a script where, using a GUI window and various inputs, I can save variables into another file to be used by other scripts. See example below for my lousy attempt at making an example of my intended application ;;;;;;;;;;;Script.au3;;;;;;;;;;; #include <GUIConstants.au3> #include <variables.au3> ;inputs ;formulas ;loops ;other random stuff ;after everything is said and done, I'll have a set of 2 or more variables $variable_a = 666 $variable_b = 777 ;I want to save/update these 2 variables (and nothing else) into "Variables.au3" to be recalled by this and other scripts ;;;;;;;;;;;Variables.au3;;;;;;;;;;; $variable_a = 0 $variable_b = 0
Maxisking Posted October 18, 2008 Posted October 18, 2008 Cant do this. unless you use filewriteline() I think :S
blessthefall Posted October 18, 2008 Author Posted October 18, 2008 Not familiar with FileWriteLine () that may be what i'm looking for, will look into it in a second.
Maxisking Posted October 18, 2008 Posted October 18, 2008 http://www.autoitscript.com/autoit3/docs/functions.htmLook in there.
blessthefall Posted October 18, 2008 Author Posted October 18, 2008 Okay, so with some searching and some testing I found a way to get the results I want, but not necessarily by the method I want. #include <File.au3> FileDelete ( "variables.au3" ) ;deletes existing variables.au3 _FileCreate ("variables.au3") ;creates new "blank" variables.au3 $file = FileOpen("variables.au3", 1) ; Check if file opened for writing OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileWrite($file, "$variable_a = 666" & @CRLF) ;writes new value to line one FileWrite($file, "$variable_b = 777") ;writes new value to line two FileClose($file) Does anyone have any suggestions for a more effective method?
autoitter Posted October 18, 2008 Posted October 18, 2008 Maybe you could use INI files. You can write a variables with the IniWrite function. IniWrite(@ScriptDir & "\MyVars.ini", "Variables", "variable_a", $variable_a) IniWrite(@ScriptDir & "\MyVars.ini", "Variables", "variable_b", $variable_
blessthefall Posted October 19, 2008 Author Posted October 19, 2008 Maybe you could use INI files. You can write a variables with the IniWrite function.IniWrite(@ScriptDir & "\MyVars.ini", "Variables", "variable_a", $variable_a)IniWrite(@ScriptDir & "\MyVars.ini", "Variables", "variable_b", $variable_I love you
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now