PVA-3000 Reference Manual
December 2, 2019 Sifos Technologies
6.2. Merging the PowerShell PSA API into TCL and Wish Shells
PowerShell PSA Software includes resource scripts that may be used to merge the PowerShell API into a native Tcl or
Wish Shell for use with other applications and API’s.
Users should be aware that in merging PowerShell with other applications, there is always the risk of a command or
global variable overlap where two or more applications use identical commands or global variables. Many
PowerShell commands and global variables begin with the characters “psa” or “psa_”, and the commands and globals
specific to the PVA-3102 almost all start with the characters “pva_”. The likelihood of a conflict with these commands
and globals is minimal.
The following table presents certain PowerShell commands and global variables that should be considered before
merging applications into a common shell.
PowerShell is provided with four Tcl source-code initialization files in the directory path:
c:\Program Files\Sifos\PSA1200\ (Microsoft Windows platforms)
<User Home Directory>/Sifos/PSA1200/ (Linux/Unix platforms)
These files may be used to import PowerShell to Tcl and Wish with the following features:
Sourcing this file will configure a Tcl shell for PowerShell including command-line
prompt that embeds present slot,port connection.
Sourcing this file will configure a Wish shell for PowerShell including command-line
prompt that embeds present slot,port connection.
Sourcing this file will layer (or add) the PowerShell API into a Tcl shell without
modifying the standard “%” prompt.
Sourcing this file will layer (or add) the PowerShell API into a Wish shell without
modifying the standard “%” prompt.
To merge the PowerShell API into a Tcl shell, execute the following command from Tcl:
source “c:/Program Files/Sifos/PSA1200/tclshrc_psapi.tcl” (Windows PC)
source “$env(HOME)/Sifos/PSA1200/tclshrc_psapi.tcl” (Linux/Unix WS)
To merge the PowerShell API into a Wish shell, execute the following command from Wish:
source “c:/Program Files/Sifos/PSA1200/wishrc_psapi.tcl” (Windows PC)
source “$env(HOME)/Sifos/PSA1200/wishrc_psapi.tcl” (Linux/Unix WS)
PowerShell Tcl and Wish may be sourced into Tcl and Wish respectively at “Level 0” or below, meaning that the
sourcing may be done by a Tcl script.
6.2.1. Initial Connection Dialog Control – PowerShell Tcl
Whenever PowerShell Tcl is initiated, the user is presented with a command prompt to either re-connect to the most
recently connected PSA chassis or to enter a new PSA address and establish a different connection. By default, this
command prompt will time out after about 8 seconds and PowerShell will then attempt to connect to the most recently
connected PSA address or subsequently to any other known PSA addresses.
Users may elect to either bypass this dialog entirely or to configure the time delay associated with the connection
prompt prior to connecting to a default (most recent or other known) address. This is done by setting the appropriate
value to the global variable psaConnectPause near the beginning of the tclshrc.tcl and/or tclsrhc_psapi.tcl
PowerShell Tcl initialization files. Normally, this global will be set to 8 seconds. If set to zero, the initial connection
prompt will be entirely bypassed and PowerShell Tcl will attempt to open a connection to the most recently connected
PSA address. The delay associated with the connection prompt may be set between 2 and 60 seconds.