Here is some code with an example - it is only a piece so it won't "work" but it should help along with the documentation. I had trouble until I found an example.
Code:
#Persistent
#SingleInstance Force
;----------------^^^ Ignore / Do Not Change Above Here ^^^----------------------------------
;***************************************************************************
; READ SETTINGS FROM INI FILE OR BUILD A NEW INI FILE
;***************************************************************************
OnExit, ExitSub
Goto, StoreyQuickNotesInitialize
;********************************************************************
; INITIALIZE THE SCRIPT FUNCTION
;********************************************************************
StoreyQuickNotesInitialize:
{
;*************************************************************************************
; IMAGE GRABBER DEFAULT CONFIGURATION OPTIONS
;*************************************************************************************
IMAGECAPTUREFOLDER=c:\StoreyQuickNotes\Images ; Default Path
IMAGEPROMPT=Patient Name (Last_First - No Commas or Spaces): ; Default folder prompt
SS_FileType=jpg ; Options jpg,png,gif,tif,bmp
SS_ScreenSize=Active ; Full, Active, Contents
;****************************************
;Initialize a few Variables each run
;****************************************
SS_FileName=
n=0
;****************************************
;Create a standard path for images
;****************************************
FileCreateDir, %IMAGECAPTUREFOLDER%
if (ErrorLevel)
{
MsgBox Error Building Default Directory`nPlease verify IMAGECAPTUREFOLDER path in the configuration section.
return
}
SetWorkingDir, %IMAGECAPTUREFOLDER%
n=0
FileCreateDir, %IMAGECAPTUREFOLDER%\Test_Folder
If (FileExist("C:\StoreyQuickNotes\SQN.ini"))
{
IniRead, Count_start, C:\StoreyQuickNotes\SQN.ini, StoreyQuickNotes, Count_start
IniRead, Count_total, C:\StoreyQuickNotes\SQN.ini, StoreyQuickNotes, Count_total
IniRead, Count_p, C:\StoreyQuickNotes\SQN.ini, StoreyQuickNotes, Count_p
IniRead, Count_b, C:\StoreyQuickNotes\SQN.ini, StoreyQuickNotes, Count_b
IniRead, Count_r, C:\StoreyQuickNotes\SQN.ini, StoreyQuickNotes, Count_r
IniRead, Count_d, C:\StoreyQuickNotes\SQN.ini, StoreyQuickNotes, Count_d
IniRead, Count_m, C:\StoreyQuickNotes\SQN.ini, StoreyQuickNotes, Count_m
IniRead, Count_g, C:\StoreyQuickNotes\SQN.ini, StoreyQuickNotes, Count_g
IniRead, PASSWORD, C:\StoreyQuickNotes\SQN.ini, StoreyQuickNotes, PASSWORD
IniRead, Name, C:\StoreyQuickNotes\SQN.ini, StoreyQuickNotes, Name
IniRead, MileStone, C:\StoreyQuickNotes\SQN.ini, StoreyQuickNotes, Milestone
SIGNATURE=Electronically Approved: %NAME%
if (Count_total>MileStone)
{
MsgBox Milestone Reached! Please Update your stats on the Support Forum
Milestone:=IncrementMilestone(Milestone)
IniWrite, %Milestone%, C:\StoreyQuickNotes\SQN.ini, StoreyQuickNotes, Milestone
}
}
else
{
Ini_file=
(
[StoreyQuickNotes]
Install_Date=%A_MM%/%A_DD%/%A_YYYY%
Version=%Version%
PASSWORD=
NAME=
MileStone=500
count_start=0
count_total=0
count_p=0
count_b=0
count_r=0
count_d=0
count_m=0
count_g=0
)
FileAppend, %Ini_file%, c:\StoreyQuickNotes\SQN.ini
; DEFINE VARIABLES
Install_Date=%A_MM%/%A_DD%/%A_YYYY%
Version=%Version%
count_start=0
count_total=0
count_p=0
count_b=0
count_r=0
count_d=0
count_m=0
count_g=0
}
count_start:=count_start+1
;*************************************************************************************
; ON EXITING PROGRAM, UPDATE THE INI FILE
;*************************************************************************************
ExitSub:
{
If (FileExist("C:\StoreyQuickNotes\SQN.ini"))
{
IniWrite, %count_start%, C:\StoreyQuickNotes\SQN.ini, StoreyQuickNotes, Count_start
IniWrite, %count_total%, C:\StoreyQuickNotes\SQN.ini, StoreyQuickNotes, Count_total
IniWrite, %count_p%, C:\StoreyQuickNotes\SQN.ini, StoreyQuickNotes, Count_p
IniWrite, %count_b%, C:\StoreyQuickNotes\SQN.ini, StoreyQuickNotes, Count_b
IniWrite, %count_r%, C:\StoreyQuickNotes\SQN.ini, StoreyQuickNotes, Count_r
IniWrite, %count_d%, C:\StoreyQuickNotes\SQN.ini, StoreyQuickNotes, Count_d
IniWrite, %count_m%, C:\StoreyQuickNotes\SQN.ini, StoreyQuickNotes, Count_m
IniWrite, %count_g%, C:\StoreyQuickNotes\SQN.ini, StoreyQuickNotes, Count_g
}
ExitApp
}