Global Variables in WinAutomation
Usage of same variables across processes is not "natively" supported inside WinAutomation. However, one could implement the following:
- Use the Get/Set Environment variable action to effectively implement the global variables.
– Create a folder named "WinAutomationJobs" in my desktop folder, and I keep all the files needed or produced by WinAutomation in Subfolders of this folder. This way we have everything organized and know exactly where every job’s resources reside.
Inside this folder there is a sub folder called resources and a text file called GlobalVariables.txt in it.
I have attached a sample job that retrieves a specific global variable from the text file (sample also attached).
Note: Place the sample files in the Desktop Folder.
Exported using WinAutomation v220.127.116.1190 Basic edition.
Hi! I'm new to WinAutomation, but not programming. What do all the 'r' and 'n' mean in this line? (?<=\$%GlobalVariableName%\r\n-\r\n)(.|\r\n)*?(?=\r\n--)
Thanks so much!
This is a Regular expression that can executed via the Parse Text action.
(.|\r\n)*? = Your string to extract (or match)
(?<=expression) .......... look behind what you want to match ,,, think of a "prefix string" that must appear before
\$ .... $ as a literal, wscapoed by backslash so it is not considered to be the special reg express token $
%GlobalvariableName% ... WA variable
\r\n .... Line Feed characters .... \r = Carriage return \n=Line Feed (CRLF or Hex 0D0A)
(.|\r\n) " . " Dot = any character, except fro LF ( \n )
| = OR
( ) capture boundaries
(.|\r\n)* ..... So, then Any character or Line Feed
* ..... repeat expression token to left, for Zero or More times
? ...... when appearing after repetition character of * or +, then the ? means 'Less Aggressive" matching, used when a '." dot is used so at to backtrack and not consume all characters after Dot, if there is a following string token to match
(?=expression) ... Look after, think of a Suffix string literal that must appear after
(?=\r\n--) so matching item must be followed by "Line Feed--"
Hope this helps.
You can also check out: www.regular-expressions.info
If you're going with the text file option, it makes a lot more sense to store it as a JSON file and then convert it to a custom object in WinAutomation. Becomes a lot easier to parse.