Powershell-Export enables you to create a customized export option (not available through other, regular CROSSCAP export options), by use of the Windows Powershell™ script language. Powershell-Export will allow access to CROSSCAP internal data objects (see sample code, far below) and is geared to creating output files and functions.
If you need to use powershell elsewhere in CROSSCAP (e.g. for index validation), please use the Powershell variable, instead (see section Use of variables, in the Appendix).
Output
Script text
Clicking the icon for the extended menu (
) will open a text-editor window.
In the top section of this window, you may enter and edit your main powershell script:
The lower (help) section contains a listing of all CROSSCAP specific powershell classes. Clicking on one of the class names will display further information about the class and the variables and properties available. Use the small green left arrow (at the bottom left) to return to the original list.
Script text if error
This powershell script (optional) will be executed, if the main powershell script fails to run properly and returns an error. Typical use for this script is to roll back all changes made by the main powershell script before the error occurred.
Code-Sample:
The following example employs the PowerShellDocument class and makes use of variable $Document and it's property BatchName:
# The name of the text file $datei = "c:\temp\test.txt" # Create a the text file with content 'Hello world!' "Hello world!" | set-content $datei # Append 'End' to the text file "End" | Add-content $datei # Append the batch name at the end $Document.BatchName | Add-content $datei