Folker Posted October 17, 2008 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.
Folker Posted October 17, 2008 Author Posted October 17, 2008 IniRead() and IniWrite() should do it.Could you provide an example of where INIRead() and Iniwrite() are used?Thanks,Folker.
Pain Posted October 17, 2008 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.
Pain Posted October 17, 2008 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")
Folker Posted October 17, 2008 Author 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.
spudw2k Posted October 17, 2008 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 Builder Misc Code Snippets: ADODB Example â—Š CheckHover ◊ Detect SafeMode â—Š DynEnumArray â—Š GetNetStatData ◊ HashArray â—Š IsBetweenDates â—Š Local Admins â—Š Make Choice â—Š Recursive File List â—Š Remove Sizebox Style â—Š Retrieve PNPDeviceID â—Š Retrieve SysListView32 Contents â—Š Set IE Homepage â—Š Tickle Expired Password â—Š Transpose Array Projects: Drive Space Usage GUI â—ŠÂ LEDkIT â—Š Plasma_kIt â—ŠÂ Scan Engine Builder â—Š SpeeDBurner â—Š SubnetCalc Cool Stuff: AutoItObject UDF â—Š Extract Icon From Proc â—Š GuiCtrlFontRotate â—Š Hex Edit Funcs â—Š Run binary â—Š Service_UDF Â
Pain Posted October 17, 2008 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
Folker Posted October 17, 2008 Author 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.
Pain Posted October 17, 2008 Posted October 17, 2008 ; section and key have to be predefined.Make sure the section name and key are correct. [sectionName] Key=Value
Folker Posted October 17, 2008 Author 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
Pain Posted October 17, 2008 Posted October 17, 2008 You got the example above. My inifile: [Message] first=hey The iniread part: $data = IniRead($file, "Message", "first", "NotFound")
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