DarkHo Posted February 21, 2010 Posted February 21, 2010 (edited) Wheal Im trying to make a save button using IniWrite and a data.ini file the problems is i want to save all actions on the program like in all cases i have made. When i press save it saves all the actions in all of the chosen casesThanks Danke Tack Grazi Edited February 21, 2010 by DarkHo
JohnOne Posted February 21, 2010 Posted February 21, 2010 What code do you have so far ? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
DarkHo Posted February 21, 2010 Author Posted February 21, 2010 This Global $IniPath = @ScriptDir & "\data.ini" IniWrite($IniPath, "Data2", "program_info", $Path2)
dani Posted February 21, 2010 Posted February 21, 2010 (edited) DarkHo you really cannot expect people to provide code for you if you do not show any effort whatsoever. Try to explain what you want in more detail to begin with, as right now it's totally unclear. Second, have you even looked at the documentation? I suppose you have as you seem to use the IniWrite correctly so I do wonder what exactly is the problem?Besides, you don't seem to have given us all your code as there will be no problems with that code if that's all. Well OK, you didn't define $Path2 yet... Edited February 21, 2010 by d4ni
DarkHo Posted February 21, 2010 Author Posted February 21, 2010 DarkHo you really cannot expect people to provide code for you if you do not show any effort whatsoever. Try to explain what you want in more detail to begin with, as right now it's totally unclear. Second, have you even looked at the documentation? I suppose you have as you seem to use the IniWrite correctly so I do wonder what exactly is the problem?Besides, you don't seem to have given us all your code as there will be no problems with that code if that's all. Well OK, you didn't define $Path2 yet...Hmm :S ok i told you that i want to add more Cases to save int the same script
Moderators Melba23 Posted February 21, 2010 Moderators Posted February 21, 2010 DarkHo,all the actions in all of the chosen casesDo you mean by this that you want to save the current contents of Inputs, Combos, Checkboxes and so on to your Ini file?If so:- Where is the code for your GUI? We have no idea of what there is to save at the moment.- Where do you want to save it? If you run under Vista or Win7 you need to think of UAC problems if your script might be placed in "Program Files".- Where is the code you have tried so far? Writing Ini files is not difficult (because AutoIt does most of the work for you ) but, as d4ni has already pointed out, you need to show a bit of effort before anyone is going to help - let alone write the code for you!Over to you! 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
DarkHo Posted February 21, 2010 Author Posted February 21, 2010 (edited) OK yes about the Inputs, Combos, Checkboxes and im using WIN XP and ini file. the ini file is added in the same folder that the program is in, Edited February 21, 2010 by DarkHo
Moderators Melba23 Posted February 21, 2010 Moderators Posted February 21, 2010 DarkHo,And the code you have tried so far?And I do not mean the 2 lines that you posted a couple of posts above - I mean a GUI with a "Save" button and some controls together with YOUR version of the code to write the contents of the controls to an Ini file.You realise that in the time you have spent giving us stupidly short replies, you could probably have coded the whole thing? You have a valid path for the Ini file and you have posted a command line with the correct syntax to write data to it - what exactly is it that you need in addition? 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
JohnOne Posted February 21, 2010 Posted February 21, 2010 I fear you may be flogging a dead horse Melba23 Global $IniPath = @ScriptDir & "\data.ini" _WriteIni("Need", "Some", "Code") Func _WriteIni($var1, $var2, $var3) IniWrite($IniPath, $var1, $var2, $var3) EndFunc AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
DarkHo Posted February 21, 2010 Author Posted February 21, 2010 (edited) I have uploaded the au3 file and exe and ini file this is only a test script. And how do i make the the script load from ini file ? :stest.zip Edited February 21, 2010 by DarkHo
Moderators Melba23 Posted February 21, 2010 Moderators Posted February 21, 2010 DarkHo, Your code was perfectly good - well done! I have shown you here how to read the Ini file and set the controls to the saved values when you start - well, some of them anyway, you still need to do some work! expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $IniPath = @ScriptDir & "\data.ini" ; read the saved input data from the ini file $sSavedPath = IniRead($IniPath, "Data2", "program_info", "No Ini") ; read the saved checkbox data from the ini file $iSavedFood = IniRead($IniPath, "Data2", "food", 0) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 181, 186, 192, 124) $Path2 = GUICtrlCreateInput("", 32, 24, 137, 21) ; Put the ini data (if it exists) in the input If $sSavedPath <> "No Ini" Then GUICtrlSetData($Path2, $sSavedPath) $Button1 = GUICtrlCreateButton("Save", 112, 56, 49, 17, $WS_GROUP) $Checkbox1 = GUICtrlCreateCheckbox("Food", 32, 96, 81, 17) ; Set the state of the check box to checked if required If $iSavedFood = 1 Then GUICtrlSetState($Checkbox1, $GUI_CHECKED) $Checkbox2 = GUICtrlCreateCheckbox("Write", 32, 120, 81, 17) $Checkbox3 = GUICtrlCreateCheckbox("Book", 32, 144, 81, 17) $Button2 = GUICtrlCreateButton("Start", 120, 136, 41, 25, $WS_GROUP) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 IniWrite($IniPath, "Data2", "program_info", GUICtrlRead($Path2)) IniWrite($IniPath, "Data2", "food", GUICtrlRead($Checkbox1)) IniWrite($IniPath, "Data2", "book", GUICtrlRead($Checkbox2)) EndSwitch WEnd I hope that shows you what you need. Do not be hesitant to post your code - you see that we are much more ready to help if we see that you have made an effort yourself first. 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
DarkHo Posted February 21, 2010 Author Posted February 21, 2010 (edited) hehe thanks man but how do i fix the other 2 Checkboxes i cant fix it. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $IniPath = @ScriptDir & "\data.ini" ; read the saved input data from the ini file $sSavedPath = IniRead($IniPath, "Data2", "program_info", "No Ini") ; read the saved checkbox data from the ini file $iSavedFood = IniRead($IniPath, "Data2", "food", 0) $iSavedWrite = IniRead($IniPath, "Data2", "food", 0) $iSavedBook = IniRead($IniPath, "Data2", "food", 0) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 181, 186, 192, 124) $Path2 = GUICtrlCreateInput("", 32, 24, 137, 21) ; Put the ini data (if it exists) in the input If $sSavedPath <> "No Ini" Then GUICtrlSetData($Path2, $sSavedPath) $Button1 = GUICtrlCreateButton("Save", 112, 56, 49, 17, $WS_GROUP) $Checkbox1 = GUICtrlCreateCheckbox("Food", 32, 96, 81, 17) ; Set the state of the check box to checked if required If $iSavedFood = 1 Then GUICtrlSetState($Checkbox1, $GUI_CHECKED) If $iSavedWrite = 1 Then GUICtrlSetState($Checkbox2, $GUI_CHECKED) If $iSavedBook = 1 Then GUICtrlSetState($Checkbox3, $GUI_CHECKED) $Checkbox2 = GUICtrlCreateCheckbox("Write", 32, 120, 81, 17) $Checkbox3 = GUICtrlCreateCheckbox("Book", 32, 144, 81, 17) $Button2 = GUICtrlCreateButton("Start", 120, 136, 41, 25, $WS_GROUP) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 IniWrite($IniPath, "Data2", "program_info", GUICtrlRead($Path2)) IniWrite($IniPath, "Data2", "food", GUICtrlRead($Checkbox1)) IniWrite($IniPath, "Data2", "write", GUICtrlRead($Checkbox2)) IniWrite($IniPath, "Data2", "book", GUICtrlRead($Checkbox3)) EndSwitch WEnd Edited February 21, 2010 by DarkHo
Moderators Melba23 Posted February 21, 2010 Moderators Posted February 21, 2010 DarkHo,You need to put the relevant If $iSaved... line AFTER the Checkbox has been created! 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
DarkHo Posted February 21, 2010 Author Posted February 21, 2010 Dont work if i check food all of them get checked expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_outfile=sd.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Global $IniPath = @ScriptDir & "\data.ini" ; read the saved input data from the ini file $sSavedPath = IniRead($IniPath, "Data2", "program_info", "No Ini") ; read the saved checkbox data from the ini file $iSavedFood = IniRead($IniPath, "Data2", "food", 0) $iSavedWrite = IniRead($IniPath, "Data2", "food", 0) $iSavedBook = IniRead($IniPath, "Data2", "food", 0) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 181, 186, 192, 124) $Path2 = GUICtrlCreateInput("", 32, 24, 137, 21) ; Put the ini data (if it exists) in the input If $sSavedPath <> "No Ini" Then GUICtrlSetData($Path2, $sSavedPath) $Button1 = GUICtrlCreateButton("Save", 112, 56, 49, 17, $WS_GROUP) $Checkbox1 = GUICtrlCreateCheckbox("Food", 32, 96, 81, 17) ; Set the state of the check box to checked if required If $iSavedFood = 1 Then GUICtrlSetState($Checkbox1, $GUI_CHECKED) $Checkbox2 = GUICtrlCreateCheckbox("Write", 32, 120, 81, 17) If $iSavedWrite = 1 Then GUICtrlSetState($Checkbox2, $GUI_CHECKED) $Checkbox3 = GUICtrlCreateCheckbox("Book", 32, 144, 81, 17) If $iSavedBook = 1 Then GUICtrlSetState($Checkbox3, $GUI_CHECKED) $Button2 = GUICtrlCreateButton("Start", 120, 136, 41, 25, $WS_GROUP) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 IniWrite($IniPath, "Data2", "program_info", GUICtrlRead($Path2)) IniWrite($IniPath, "Data2", "food", GUICtrlRead($Checkbox1)) IniWrite($IniPath, "Data2", "write", GUICtrlRead($Checkbox2)) IniWrite($IniPath, "Data2", "book", GUICtrlRead($Checkbox3)) EndSwitch WEnd
Moderators Melba23 Posted February 21, 2010 Moderators Posted February 21, 2010 DarkHo,Notice anything? $iSavedFood = IniRead($IniPath, "Data2", "food", 0)$iSavedWrite = IniRead($IniPath, "Data2", "food", 0)$iSavedBook = IniRead($IniPath, "Data2", "food", 0) 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
DarkHo Posted February 21, 2010 Author Posted February 21, 2010 DarkHo,Notice anything? $iSavedFood = IniRead($IniPath, "Data2", "food", 0)$iSavedWrite = IniRead($IniPath, "Data2", "food", 0)$iSavedBook = IniRead($IniPath, "Data2", "food", 0) M23hehe yes im a fool i didn't see it hehe
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