
' Demo - Load file / Decode to vars / Print vars

Variable String  Option1
Variable String  Option2
Variable String  Option3
Variable Numeric Velocity
Variable Numeric Delay

Gosub DecodeOptionFile

Gosub PrintOptions

Stop


Label DecodeOptionFile
	' ---------------------------------------- load the file
	Load s1 "SetupFile.txt"
	' ---------------------------------------- get number of lines
	v1 = GetSeparatedStringCount(s1, CRLF)
	' ---------------------------------------- for each line...
	For v2 = 0 To v1
		' ------------------------------------ get the line to s2
		s2 = GetSeparatedString(s1, v2, CRLF)
		' ------------------------------------ get the name to s3
		s3 = GetSeparatedString(s2, 0)
		' ------------------------------------ get the value to s4
		s4 = GetSeparatedString(s2, 2)
		' ------------------------------------ decode option names
		Select s3
			Case "Option1"
				Option1 = s4
			Case "Option2"
				Option2 = s4
			Case "Option3"
				Option3 = s4
			Case "Velocity"
				Velocity = s4
			Case "Delay"
				Delay = s4
		EndSelect
	Next
Return

Label PrintOptions
	' -------------------------------- open the TextBox
	Controls OpenTextBox
	Controls ClearTextBox 
	Print CRLF
	' -------------------------------- print the options
	Print Option1 + CRLF
	Print Option2 + CRLF
	Print Option3 + CRLF
	Print Velocity + CRLF
	Print Delay + CRLF
Return


'WATCH s2
'WATCH s3
'WATCH s4
'WATCH Option1
'EXEC Gosub test2
