FileValueFind
Top  Previous  Next


Returns a string from a text file - search all rows for a value in one column, if match return value from other column

This function is useful to for example read values from the data section in another script file.

FileValueFind (FileName, StartTag, EndTag, Delimiter, FindInColumn, Find, ReadFromColumn)

FileName
Name of text file to read value from, include full path if not current directory  
Maximum file size is 300k, larger files will not be opened  

StartTag [Optional parameter]
Tag (text string) to start reading after;all text before the start tag is ignored  

EndTag [Optional parameter]
Tag (text string) to start reading before; all text after the start tag is ignored  

Delimiter
Column delimiter  
Valid options: semicolon | comma | colon | tab  

FindInColumn
Column to search for text in, 1-100  
Notice: columns must be delimited with the character specified in the delimiter parameter  

Find
What to find (not case sensitive)  
 
ReadFromColumn
Column to read text from if match is found, 1-100  
Notice: columns must be delimited with the character specified in the delimiter parameter  

Example
Script file "myscript.cnu" contains this

.
.
[Data_Begin]
         Inet1   a2f13a7e      
         Inet2   16b4f8be      
         Inet3   2125e66d      
         Inet4   a29fdbc2      
         Inet5   2f747387      
         Inet6   b9936b4d      
[Data_End]


SET pass=FileValueFind(c:\myscript.cnu,[Data_Begin],[Data_End],tab,4,inet3,5)   
MessageBox %pass%


Displays "2125e66d"