|
<< Click to Display Table of Contents >> Navigation: SP 0.0 > Enhancements > PowerShell (.ps1) and Python (.py) scripting > PowerShell and Python scripting full support |
R26 is now fully compatible with PowerShell and Python scripting:
•PowerShell or Python can be used everywhere it was possible to use a vbs script, for example in ShortcutBar or with the .VBScript directive in a Variant Note.
•PowerShell and Python now support a direct function call or parameter passing in the same way as vbs. Please note that the parameters syntax remains the same for compatibility reason: if a variant note was calling a .lst file passing parameters, now the .lst can be converted internally to a .ps1 script without the need to change the note.
Example: if the parameters in the note are defined as follows:
Script_File_Name&@Para1=val1[\r\nPara2=val2[\r\nPara3=val3[…]]]
•In PowerShell the script needs to declare input parameters named Para1, Para2, Para3.
param(
[string] $Para1,
[string] $Para2,
[string] $Para3
)
In Python the parameters are passed with the standard syntax and can be parsed using the standard argparse module. The script is invoked as follows (please note that the double ‘-’ sign is added by the PDM framework):
script.py --Para1 val1 --Para2 val2 --Para3 val3
•The .async directive has been also implemented for both PowerShell and Python scripts in order to have launch-and-forget scripts, that means scripts running in parallel.
Other directives like .x64 or .include are no more necessary.