Jump to content
Sign in to follow this  

Cannot save ini file when the string contains ':'

Recommended Posts


hello guys,

i'm new at autoit scripting. i used to code in VB6, after i found autoit, i'm started to think that autoit is easier to use :)

now i'm facing some problem,

i was trying to save a directory path into an ini files (via IniWrite function). But i find out that the path is not saved to files. I'm trying to figuing out what was the problem, and i think the ':' was the problem. Because when i delete the ':', the path saved successfully.

here's my code:

Func InitSettings()
if not FileExists("settings.ini") then
IniWrite ( "settings.ini", "section", "key", "value" )
$BBoy = iniread("settings.ini", "Settings", "BBoy","")
$PF = iniread("settings.ini", "Settings", "PF","")
$audi = iniread("settings.ini", "Settings", "Audi","")
$pass = iniread("settings.ini", "Start", "Pass","")
$d1 = iniread("settings.ini", "Settings", "Delay1","")
$d2 = iniread("settings.ini", "Settings", "Delay2","")
$AutoLogon = iniread("settings.ini", "Start", "AutoLogon","")
GUICtrlSetData($Input1, $BBoy)
GUICtrlSetData($Input2, $PF)
GUICtrlSetData($Input3, $audi)
GUICtrlSetData($Input4, $pass)
GUICtrlSetData($Input5, $d1)
GUICtrlSetState($Checkbox1, $AutoLogon)
Func SaveSettings()
$BBoy = GUICtrlRead($Input1)
$PF = GUICtrlRead($Input2)
$audi = GUICtrlRead($Input3)
$pass = GUICtrlRead($Input4)
$d1 = GUICtrlRead($Input5)
$d2 = GUICtrlRead($Input6)
$AutoLogon = GUICtrlRead($Checkbox1)
iniwrite("settings.ini", "Settings", "BBoy", $BBoy)
iniwrite("settings.ini", "Settings", "PF", $PF)
iniwrite("settings.ini", "Settings", "Audi", $audi)
iniwrite("settings.ini", "Start", "Pass", $pass)
iniwrite("settings.ini", "Settings", "Delay1", $d1)
iniwrite("settings.ini", "Settings", "Delay2", $d2)
iniwrite("settings.ini", "Start", "AutoLogon", $AutoLogon)

the paths are $Input1, $Input2, $Input3

everything is saved perfectly except that.

thank you for reading , and sorry for my terrible english :P


edit: i think ':' doesn't cause the problem.

the problem is come from

Case $Button4
$File = FileOpenDialog ("Browse for BBoy Cheat...", "", "Executable file (*.exe)", 1+4)
GUICtrlSetData($Input1, $File)

i assign $Input1 value from FileOpenDialog, and then i try to save with

$BBoy = GUICtrlRead($Input1)
iniwrite("settings.ini", "Settings", "BBoy", $BBoy)

and doesnt work. But when i enter some path directly to the $Input1, the saving method above works.

dunno where's my fault, so please help me :(

Edited by awangn6600

Share this post

Link to post
Share on other sites


Welcome to the Autoit forum. :)

Using FileOpenDialog changes the working folder when you use it - so as you do not specify a path when you write to the ini file, the file is created in whichever folder you selected with FileOpenDialog.

There are 2 solutions available to you:

- 1. Reset the working folder to the script folder once you have used FileOpenDialog:


- 2. Use a full path for the IniWrite file:

IniWrite(@ScriptDir & "\settings.ini", "Settings", .....)

All clear? :)


P.S. I see that you are writing a script which loads game cheats. Please read the Forum rules (there is also a link at bottom right of each page) and note that we do not support such scripts. This thread will now be locked. :naughty:

Please do not ask for any more help with this script - or any others which go against the forum rules. You only got the above because the learning point is one worth making to a wider audience and you have not got very far with your script. ;)

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


Share this post

Link to post
Share on other sites
This topic is now closed to further replies.
Sign in to follow this