Write MultiLine To INI File

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
roonyrooxcess
Posts: 61
Joined: 20 Nov 2020, 21:29

Write MultiLine To INI File

Post by roonyrooxcess » 02 Feb 2023, 14:48

I'm trying to figure out how to write a multiline variable to an ini file, but cant figure out how the syntax.

Atm it just returns the first line in the variable.

Thanks!

The Code :

Code: Select all

#NoEnv
#SingleInstance Force


ML :="
(
{}
hkkhk

gjgj
[]
:;.,""@'#
)"


IniWrite, %ML%, D:\Project\VSync\Launch\Test\myfile2.ini, Array, MultiLine

IniRead, OutputVar, D:\Project\VSync\Launch\Test\myfile2.ini, Array, MultiLine

MsgBox,% OutputVar

}

Return

ahk7
Posts: 575
Joined: 06 Nov 2013, 16:35

Re: Write MultiLine To INI File

Post by ahk7 » 02 Feb 2023, 15:49

You can't as INI doesn't support it. You will have to replace the new lines with something when writing, and back again when reading - here simply with StrReplace

Code: Select all

#NoEnv
#SingleInstance Force

ML :="
(join`n
{}
hkkhk

gjgj
[]
:;.,""@'#
)"

IniWrite, % StrReplace(ML,"`n","\n"), myfile2.ini, Array, MultiLine
IniRead, OutputVar, myfile2.ini, Array, MultiLine
MsgBox, % StrReplace(OutputVar,"\n","`n")

Return

Post Reply

Return to “Ask for Help (v1)”