Folker Posted October 17, 2008 Share Posted October 17, 2008 Hey, I was wondering whether i could create a application that can read data from a ini and display it onscreen - and then in the menu, say, edit that ini or create a new one? Thanks, Folker. Link to comment Share on other sites More sharing options...
Pain Posted October 17, 2008 Share Posted October 17, 2008 IniRead() and IniWrite() should do it. Link to comment Share on other sites More sharing options...
Folker Posted October 17, 2008 Author Share Posted October 17, 2008 IniRead() and IniWrite() should do it.Could you provide an example of where INIRead() and Iniwrite() are used?Thanks,Folker. Link to comment Share on other sites More sharing options...
Pain Posted October 17, 2008 Share Posted October 17, 2008 http://www.autoitscript.com/autoit3/docs/f...ons/IniRead.htmhttp://www.autoitscript.com/autoit3/docs/f...ns/IniWrite.htmRemember to always use the helpfile. Link to comment Share on other sites More sharing options...
Folker Posted October 17, 2008 Author Share Posted October 17, 2008 How can i make INI files? Link to comment Share on other sites More sharing options...
Pain Posted October 17, 2008 Share Posted October 17, 2008 Did you even bother to click on the links? IniWrite: If file does not exist, it is created. This one will create a ini file with the name myfile.ini in C:\Temp\ and write some data to it. IniWrite("C:\Temp\myfile.ini", "section2", "key", "this is a new value") Link to comment Share on other sites More sharing options...
Folker Posted October 17, 2008 Author Share Posted October 17, 2008 Did you even bother to click on the links? IniWrite: This one will create a ini file with the name myfile.ini in C:\Temp\ and write some data to it. IniWrite("C:\Temp\myfile.ini", "section2", "key", "this is a new value") Ok, sorry. I have made the ini file and want to load it from a FileOpenDialog command, so i open it, but now i want to see the ini file, i tried this: $label = IniRead("" & $open,"SECTION1","name") and $label = IniRead( $open,"SECTION1","name") and $label = IniRead(& $open,"SECTION1","name") but they all gave me errors.. how would i click the open button and then it displays the text on the gui, in say, a label? Thanks, Folker. Link to comment Share on other sites More sharing options...
spudw2k Posted October 17, 2008 Share Posted October 17, 2008 (edited) To modify a control (apply data to it) use the GUICtrlSetData Func. Check the helpfile. ;$label = GUICtrlCreateLabel...... GUICtrlSetData($label,"message here") Edited October 17, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF  Link to comment Share on other sites More sharing options...
Pain Posted October 17, 2008 Share Posted October 17, 2008 #include <GUIConstants.au3> GUICreate("") $select = GUICtrlCreateButton("Open file", 50, 50) $label = GUICtrlCreateLabel("test", 150, 100) GUISetState (@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $select Then $file = FileOpenDialog("Select a file.", @DesktopDir & "\", "INI (*.ini)") $data = IniRead($file, "section2", "key", "NotFound"); section and key have to be predefined. GUICtrlSetData($label, $data) EndIf If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend Link to comment Share on other sites More sharing options...
Folker Posted October 17, 2008 Author Share Posted October 17, 2008 #include <GUIConstants.au3> GUICreate("") $select = GUICtrlCreateButton("Open file", 50, 50) $label = GUICtrlCreateLabel("test", 150, 100) GUISetState (@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $select Then $file = FileOpenDialog("Select a file.", @DesktopDir & "\", "INI (*.ini)") $data = IniRead($file, "section2", "key", "NotFound"); section and key have to be predefined. GUICtrlSetData($label, $data) EndIf If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend I do this, but it displays NotFound from the $data command in the gui. i want it to display the data from the ini file. Thanks, Folker. Link to comment Share on other sites More sharing options...
Pain Posted October 17, 2008 Share Posted October 17, 2008 ; section and key have to be predefined.Make sure the section name and key are correct. [sectionName] Key=Value Link to comment Share on other sites More sharing options...
Folker Posted October 17, 2008 Author Share Posted October 17, 2008 (edited) Make sure the section name and key are correct. [sectionName] Key=Value Im trying to load it so that i can open one ini file and it displays the data, and then i can load another INI file and it will display diffrent data. Say im loading: test1.ini and test2.ini i want to load test1 first using the opendialog so it displays say, hello (predefined in the ini already created) and then use opendialog again to open test2, which would say, hey! (also predefined in a diffrent ini file.) is there a way to do this? Edited October 17, 2008 by Folker Link to comment Share on other sites More sharing options...
Pain Posted October 17, 2008 Share Posted October 17, 2008 You got the example above. My inifile: [Message] first=hey The iniread part: $data = IniRead($file, "Message", "first", "NotFound") Link to comment Share on other sites More sharing options...
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