darkxraver Posted February 17, 2009 Posted February 17, 2009 hey i need a little help i cant figure this out.. i have a inputbox which has the standard value of "0" as you can see below $earth1 = GUICtrlCreateInput("0", 45, 70, 55, 20) so i open my gui and enter a different number and hit the save button and it writes the new value into the .ini file $Button1 = GUICtrlCreateButton("Save", 350, 20, 55, 20) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 INIWRITE("test.ini", "EARTH", "Earth 1", GUICtrlRead($earth1)) EndSwitch WEnd GUIDelete() EndFunc ;==>Example1 what i want it to do is everytime i open the script again it should read the value of the ini file and replace the inputbox value with the new saved one i.e. inputbox "0" .. i change it to "5" hit save its saved in the ini file.. i close my script open it again and the standard value is "5" .. change it to "77" hit save - saves it in the ini file.. i close the script again, open it again and the inputbox value is "77" i dont know how to do that.. the only thing what i did is i changed the inputbox to something like this $ini=IniRead("test.ini", "EARTH", "Earth 1", "") $earth1 = GUICtrlCreateInput($ini, 45, 70, 55, 20) but then if i have no ini file and start the script the first time the inputbox will be blank - no value in it (if i enter a value - save - close the script - open it again, the new value will be shown) but id like the standard values to be "0" for the first time that i start the script hope you understand my problem and can help me out thx
BrettF Posted February 17, 2009 Posted February 17, 2009 Something like this works for me. $inifile = @ScriptDir & "\test.ini" $current_value = IniRead ($inifile, "section", "key", "default") $input = InputBox ("Enter new value!", "Current value is: " & $current_value) IniWrite ($inifile, "section", "key", $input) $current_value = IniRead ($inifile, "section", "key", "default") $input = MsgBox (0, "", "New value is: " & $current_value) Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Manjish Posted February 17, 2009 Posted February 17, 2009 how about: $ini=IniRead("test.ini", "EARTH", "Earth 1", "") if @error then $ini='0' $earth1 = GUICtrlCreateInput($ini, 45, 70, 55, 20) This will assign default '0' value to $ini.. if ur file doesn't exist.. [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
BrettF Posted February 17, 2009 Posted February 17, 2009 IniRead already has that! Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Manjish Posted February 17, 2009 Posted February 17, 2009 IniRead already has that!ya it does.. i forgot.. .. what a dumbass memory.. hahaha;) [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
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