-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathIniReadWrite.au3
21 lines (21 loc) · 1.3 KB
/
IniReadWrite.au3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
; #FUNCTION# ====================================================================================================================
; Name ..........: IniReadWrite
; Description ...: Write the default value to Ini if it does not exist
; Syntax ........: IniReadWrite($sFile, $sSection, $sKey, $sDefault)
; Parameters ....: $sFile - The path for the .ini file.
; $sSection - The section name in the .ini file.
; $sKey - The key name in the .ini file.
; $sDefault - The default value.
; Return values .: The value of the $sKey in the Ini file or $sDefault if the $sKey does not exists
; Author ........: Damon Harris (TheDcoder)
; Remarks .......: PRO TIP: IniReadWrite is fully compatible with IniRead (i.e Same parameters)
; Related .......: IniRead and IniWrite
; Link ..........: https://gist.github.com/TheDcoder/b5035d600b7a130ea45311541a15a555
; Example .......: No
; ===============================================================================================================================
Func IniReadWrite($sFile, $sSection, $sKey, $sDefault)
Local $sIniRead = IniRead($sFile, $sSection, $sKey, "")
If Not $sIniRead = "" Then Return $sIniRead
IniWrite($sFile, $sSection, $sKey, $sDefault)
Return $sDefault
EndFunc