asym Posted July 5, 2010 Share Posted July 5, 2010 (edited) So I have this form and want autoit to write in a ini file the content entered in the input box and the result of the 3 checkboxes (if its checked or not) But for some reason its not writing the correct values in the ini file... What am I doing wrong? And what is the default result for checkboxes to say if they are checked or unchecked and how can I write that on a ini file? Not even the delay... and thats number on a input box ... its not writing anything as it should on the ini file $Form1 = GUICreate("Form1", 210, 191, 297, 322) $del = GUICtrlCreateInput("", 96, 40, 97, 21) $cb1 = GUICtrlCreateCheckbox("1", 8, 112, 97, 17) $cb2 = GUICtrlCreateCheckbox("2", 8, 136, 97, 17) $cb3 = GUICtrlCreateCheckbox("3", 8, 160, 97, 17) $Velocidade = GUICtrlCreateLabel("Velocidade:", 8, 40, 84, 24) GUICtrlSetFont(-1, 12, 800, 0, "Myriad Pro Light") $Label1 = GUICtrlCreateLabel("(Recomendado 3000 - 5000ms)", 8, 64, 190, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Titulo", 8, 88, 171, 24) GUICtrlSetFont(-1, 12, 800, 0, "Myriad Pro Light") $bt1 = GUICtrlCreateButton("Save", 104, 128, 75, 25, $WS_GROUP) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $delay=GUICtrlRead ( $del,0 ) $cbr1=GUICtrlRead ( $cb1,0 ) $cbr2=GUICtrlRead ( $cb2,0 ) $cbr3=GUICtrlRead ( $cb3,0 ) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $bt1 IniWrite("C:\Users\username\Desktop\myfile.ini", "section1", "Delay", $delay) IniWrite("C:\Users\username\Desktop\myfile.ini", "section1", "1", $cbr1) IniWrite("C:\Users\username\Desktop\myfile.ini", "section1", "2", $cbr2) IniWrite("C:\Users\username\Desktop\myfile.ini", "section1", "3", $cbr3) Exit EndSwitch WEnd Oh and I also want it to when I click the Save button to create the ini (even overwriting it it already exists) and close the form... Is it right? Cuz I had some doubts about that (Case $bt1 thingy) Edited July 5, 2010 by kaneco Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 5, 2010 Moderators Share Posted July 5, 2010 kaneco,You need to read the input and radios just before you write them - you were reading them immediately after they were created, so they were obviously empty.Look at this: expandcollapse popup#include <GUIConstantsEx.au3> $sIniFile = "C:\Users\username\Desktop\myfile.ini" $Form1 = GUICreate("Form1", 210, 191, 297, 322) $del = GUICtrlCreateInput("", 96, 40, 97, 21) $cb1 = GUICtrlCreateCheckbox("1", 8, 112, 97, 17) $cb2 = GUICtrlCreateCheckbox("2", 8, 136, 97, 17) $cb3 = GUICtrlCreateCheckbox("3", 8, 160, 97, 17) $Velocidade = GUICtrlCreateLabel("Velocidade:", 8, 40, 84, 24) GUICtrlSetFont(-1, 12, 800, 0, "Myriad Pro Light") $Label1 = GUICtrlCreateLabel("(Recomendado 3000 - 5000ms)", 8, 64, 190, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Titulo", 8, 88, 171, 24) GUICtrlSetFont(-1, 12, 800, 0, "Myriad Pro Light") $bt1 = GUICtrlCreateButton("Save", 104, 128, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $bt1 $delay = GUICtrlRead($del, 0) $cbr1 = GUICtrlRead($cb1, 0) $cbr2 = GUICtrlRead($cb2, 0) $cbr3 = GUICtrlRead($cb3, 0) IniWrite($sIniFile, "section1", "Delay", $delay) IniWrite($sIniFile, "section1", "1", $cbr1) IniWrite($sIniFile, "section1", "2", $cbr2) IniWrite($sIniFile, "section1", "3", $cbr3) Exit EndSwitch WEndThe IniWrite function automatically create or overwrite an existing file.And you seem to have understood the "Case $bt1 thingy" quite well. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
asym Posted July 5, 2010 Author Share Posted July 5, 2010 wow thanks a lot Allways learning 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