Royal TS V7.3 has been upgraded with a powerful new feature, which lets you use environment variables for replacement tokens within Dynamic Folder scripts.
A big advantage of this is, that the Dynamic Folder Script stays constant and can even be signed.
To activate this function, open your Dynamic Folder Script and go to the Advanced section.
Once there, you are able to set the Token Handling option from the default setting (Replace Inline) to the new configuration Environmental Variables. This is possible for Dynamic Folder Scripts, as well as for Dynamic Credentials Scripts.
Furthermore, you can also add various Tokens through the flyout button and set a Prefix for the tokens.
Environments variable will be created for the script in the following way (assuming the prefix is ’DynFolder_’:
The replacement token $EffectiveUsername$ will be available in the environment variable DynFolder_ EffectiveUsername.
Dots (.) in replacement tokens will be substituted with the underscore (_) character:
$this.EffectiveUsername$ = DynFolder_this_EffectiveUsername
$CustomProperty.AccountPassword = DynFolder _CustomProperty_AccountPassword
For an example of accessing a Custom Property via this functionality in a Dynamic Folder script written in Python, please take a look at the following example:
We’ve defined two Custom Properties Username and Password and filled them with values:
Afterwards, we’ve added the two values via the Custom Property Token and adjusted the name so it refers to the Custom Properties we’ve created earlier:
Lastly, we’ve adjusted the Python Dynamic Folder Script template to reflect the two new Custom Properties:
To access Environmental Variables via Python, the os.environ prefix is required.
In our example this would be:
”Username": os.environ['DynFolder_CustomProperty_Username’]
&
”Password": os.environ['DynFolder_CustomProperty_Password’]
If the script interpreter is set to PowerShell, the $env: prefix is required:
Username = $env:DynFolder_CustomProperty_Username
We hope you enjoy this new feature. If you want to contact us or leave feedback in general, you can do so here.