Description
WWGetString() is used to get strings out of an ASCII-file, which includes a number of strings each characterized by an unique index.
Use
Output = WWGetString(Path, Separator, Index);
Path | A Message tag or a quoted string (example: “C:\text.csx”) with the path of the ASCII-file) |
Separator | A Message tag or a quoted string (example: “;”), which is used as separator in the csv-file |
Index | A Integer tag (example: 1), which is also included in the csv-file reffering to a textstring |
Output | A Message tag that is used to return the corresponding string of the index-number |
Returns
If the function works OK, the corresponding string of the index-value will be returned, otherwise the corresponding error message is returned by the function.
The following table lists possible error messages: Error message File open error! |
Details of WWGetString()
A special format is needed for the ASCII file that holds the indices and the corresponding strings:
Each single line of the file can only hold one index plus the corresponding string. The line must begin with the index (a simple number). Leading spaces and zeros are ignored.
Index numbers of different lines do not have to be in any order. The maximum index number allowed is 999999. However, for performance reasons it is better to divide a very large ASCII file in multiple, smaller files.
The number must be followed by a separator (comma, semicolon or similar). Spaces will be ignored.
The rest of the text in the line following directly behind the separator is the string which corresponds to the index number.
Lines that do not start with a number are interpreted as comment lines and therefore are not used by the function WWGetString().
Since the index and the string are separated, this type of file is often referred to as a comma separated values file or CSV. Only ASCII characters may be used in the file. Individual lines must be terminated by a Carriage Return/New Line that is by the ASCII characters 13 and 10. Such a file can be generated by most of the spreadsheet programs for windows and – most simply – by the notepad editor of windows. Be aware that most word processors generate no pure ASCII files in their standard configuration.
Example of Using WWGetString()
Sample File
A typical file used with WWGetString() may look as follows:
1 ,First entry 2 , Second entry 1000,Entry with a high index number
Imagine this file is saved at C:\TEST.CSV then
Output = WWGetString(“C:\TEST.CSV”, “,”, 1); results in Output= “First Entry”
Output = WWGetString(“C:\TEST.CSV”, “,”, 2); results in Output= ” Second Entry”
Output = WWGetString(“C:\TEST.CSV”, “,”, 1000); results in Output= “Entry with a high index number”
Download the WWGetString.zip file.
- Unzip the WWGetString.zip file.
- Copy the WWGetStr.dll, WWGetStr.wdf and WWGetStr.hlp files and place them in your InTouch™ Install directory.
The function will then be available from scripts when running WindowMaker.
2 thoughts on “WWGetString Function Library”
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36
There are bugs!:
“1,A” => returns “String is empty!” because the string is shorter than 2 characters, this doesn’t make sense
“1,01” => works as decribed
If you use another separator like “:”, still this message can appear:
“No comma found behind index number!” => Wrong error message!
I would want no error String “String is empty!” but empty strings for the following:
1:
2:
3:not empty
Protip for others:
Use Industrial graphics (Archestra) scripts if possible and have all the Dot.Net API (with streamreader/streamwriter objects) at your hands instead of this faulty DLL.
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/109.0
Good feedback, since this is a very old plugin written by WW, the offical, i dont have the source, so i changed it with some modify, you can download the fixed version or modify it yourself with some hex tools, such as Winhex, Ultraedit etc.
Mod: Chage the byte at 0x000012DA from 0x75 to 0xEB of WWGetStr.dll. Save and replace with the new DLL in Intouch folder.
Effect: WWGetstring will return string that lenght is 0 or 1. In your case, the “A” or “” can be returned.
Verified on Intouch 2023.