JohnOne Posted August 20, 2009 Posted August 20, 2009 Is it possible to give the ini file you create a name based on a variable while creating the file (if you get me I've been experimenting on one of the examples from the AutoIt help file, bu a bit stumped #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 214, 92, 192, 124) $Input1 = GUICtrlCreateInput("Input1", 8, 16, 161, 21) $Button1 = GUICtrlCreateButton("Cancel", 24, 48, 75, 25, $WS_GROUP) $Button2 = GUICtrlCreateButton("Create", 120, 48, 75, 25, $WS_GROUP) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Exit Case $Button2 $sIni = @DesktopDir & "\name.ini" $data = GUICtrlRead($Input1) IniWrite($sIni, "section2", "key", "this is a new value") Exit EndSwitch WEnd I would like to name the ini file which this code creates by the value of $Input1 So when the script is ran, the resulting file in this case would be Input1.ini Once again I apologise if my question is noob AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Valuater Posted August 20, 2009 Posted August 20, 2009 Maybe.... #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 214, 92, 192, 124) $Input1 = GUICtrlCreateInput("Input1", 8, 16, 161, 21) $Button1 = GUICtrlCreateButton("Cancel", 24, 48, 75, 25, $WS_GROUP) $Button2 = GUICtrlCreateButton("Create", 120, 48, 75, 25, $WS_GROUP) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Exit Case $Button2 $sIni = @DesktopDir & "\name.ini" $data = GUICtrlRead($Input1) IniWrite(@DesktopDir & "\" & $data & ".ini", "section2", "key", "this is a new value") Exit EndSwitch WEnd BTW, I appreciate the example script!!! 8)
JohnOne Posted August 20, 2009 Author Posted August 20, 2009 (edited) Brilliant >_< I appreciate your time mate That should give me enough to be getting on with Also I was able to remove the line $sIni = @DesktopDir & "\name.ini" Edited August 20, 2009 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
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