|
Post by fragadelic on Dec 3, 2010 17:04:19 GMT 1
For my remastersys project I needed a way to read in variables so this is what I came up with.
In the config file it has to simply be in the format with no spaces on either side of the = sign:
variable=value
No quotes are needed for the value
REM Example to read from config file OPEN "sample.conf" FOR READING AS configfile WHILE NOT (ENDFILE(configfile)) DO READLN value$ FROM configfile REM PRINT value$ IF NOT(ENDFILE(configfile)) THEN REM Get variable name from left of = sign variable$ = LEFT$(value$, INSTR(value$, "=")-1) REM Get variable value from right of = sign varvalue$ = MID$(value$, INSTR(value$, "=")+1) REM PRINT variable$, "=", varvalue$ SETENVIRON variable$,varvalue$ ENDIF WEND
winname$=GETENVIRON$("winname") progressname$=GETENVIRON$("progressname") progresstext$=GETENVIRON$("progresstext") REM End of Example to read from config file
Here is the config file
winname=The Program progressname=Super Progress Bar progresstext=Installing....Please Wait
I'm open to suggestions if there are any better ways to read in a config file and if not I hope someone else can also make use of this.
|
|
|
Post by Pjot on Dec 3, 2010 17:23:35 GMT 1
We've had a similar discussion on the Puppy Linux forum. Please check this thread at half of the page where some solutions were provided. Best regards Peter
|
|
|
Post by fragadelic on Dec 3, 2010 17:28:21 GMT 1
Dang...thats much nicer than my kludge.
Thanks a lot.
|
|