vbscript - Read data from ini file -


I have a vbscript that takes the input filename

is the code

  DimTiot: Set tsout = gofs.CreateTextFile ("C: \ .... csv") Set by default: tsin = gofs.OpenTextFile ("C: \ ..... csv")   

How can I configure this path so that path createTextFile (....) config file ( .ini )

The file should be taken from the ini file to create and write the output-to-page

This is my IN i file

/ / My INi file

  [read_file] tsout = E: ..... tt.csv tsin = E: \ .... gt.csv [cola] number1 = 4 number2 = 5    

A simple version of an .ini file parser:

  option clear dim goFS: goFS = CreateObject ("Scripting. File system object ") 'WScript.Quit demoReadFile () WScript.Quit demoReadIniFile () function demoReadFile () demoReadFile = 0 dim tsIn: set tsIn = goFS.OpenTextFile (". \ 21825192 Ini ") Until the end of the day till ts.AtEnd: Slain = TSI. Readline () WScript.Echo tsIn.Line - 1, Slench loop tsIn.Close End Function Function demoReadIniFile () demoReadIniFile = 0 Dim dicIni: Set dicIni = ReadIniFile (".21825192.ini") for each SSec, DCINIKs WScript.Echo "---", sSec for each sKV in dicIni (SCEC) .SECE (SSCE), SEC, DCIN (SSEC). Wise. ("Path") End Function function ReadIniFile (sFSpec) Dim dicTmp ("s") : Set dicTmp = CreateObject ("Sc Ripting.Dictionary ") Set tsIn = GoFS OpenTextFile (SFSPCEC) Them Lineline, SACEC, Eksee TSE andOffustream Sline = Trim (TSI readline), if" ["= Left (Lines, 1) then SACEC = Mid (Asline , 2, lane (selin) - 2) Set dicTmp (ssec) = CreateObject ("Scripting.Dictionary") otherwise if "" << if 1 = Ubound (Ekvy) then DICTMP (SACEC) (trim ( Ekvy (0)) = Trim (Ekvy (1)) End if end if end if loop is in TSI then SLEE = Split (SLI = Split) set readinefile = dicTmp termination function   

Output:

  cscript 21825192.vbs 1 [pipapo] 2 path = E: \ dont \ Find \ me Set off csv3 some = thing other 4 5 [tsout] 6 path = e: \ where \ sometimes \ output.csv 7 abc = def cscript 21825192.vbs --- pipapo path = & gt; E: \ dont \ find \ me.csv = some => Talk and --- tsout path = & gt; E: \ where \ times \ output.csv abc = & gt;  

Update wrt comment / edit:

/ P>

I have added my sample to my sample .i file:

  type 21825192.ini [pipapo] path = E: \ n \ Find \ me.csv something = Cheese other [tsout] path = E: \ where \ sometimes \ output.csv abc = def [read_file] tsout = e: ..... tt.csv tsin = E: \ .... gt.csv [col ] Number 1 = 4 number 2 = 5   

And for just clarity - the last output line of my demo window () function in this WScript.Echo "tsout.Path", Dicini ("Tate") ("Path") WScript.Echo "Read_file.tsin", dicIni ("read_file") has been modified:

 ("Tsin") WScript.Echo "col.Number2", dicIni ("col") ("number 2")   

Output:

  Cscript 21825192.vbs --- pipapo path = & gt; E: \ dont \ find \ me.csv = some => Talk and --- tsout path = & gt; E: \ where \ times \ output.csv abc = & gt; Def --- Read_file tsout = & gt; E: ..... tt.csv tsin = & gt; E: \ .... gt.csv --- call no.1 = & gt; 4th number 2 = & gt; 5 tsout.Path E: \ where \ ever \ output.csv Read_file.tsin E: \ .... gt.csv col.Number2 5   

So I do not understand at all Why is entering 'Call number 1 = 4 and number 2 = 5' causes any problem by taking out.

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -