
PowerSync Analyzer Reference Manual
March 9, 2010
Sifos Technologies page
57
4. PowerShell Scripting Environment
PowerShell is a script development and interactive command execution shell built upon the Tcl/Tk scripting language
(version 8.4.5 or later). Tcl/Tk is an open source, portable, and easily extendable programming language developed for
Unix (Linux) and subsequently extended to Windows and MAC operating systems. Compiled versions of Tcl/Tk are
available (at no charge) from the ActiveState Web-Site.
Tcl (Tools Command Language) is a scripting language consisting entirely of commands for developing programs that
run on and utilize command line interfaces. Tk is a significant extension to Tcl to enable Graphical User Interface
(GUI) applications that are (for the most part) platform-independent.
4.1.
TCL and Wish Shells
PowerShell is provided with access to both a Tcl shell and a Wish shell. Shells are interactive command consoles just
like the traditional DOS command shell that accompanies Windows or a “terminal” shell in Linux. In fact, when a
Tcl
or
Wish shell
is opened on a Windows-based system, traditional DOS commands such as “dir” are fully available.
Both Tcl and Wish shells support interpretive command execution, meaning commands may be typed and executed
immediately when the [Enter] key is pressed. There is no compilation or linking required for Tcl/Tk commands. This
feature makes Tcl/Tk an attractive solution for instrument control. Tcl is also quite powerful at managing and
analyzing arbitrary data structures through its “list processing” capabilities. There is a considerable body of
information regarding Tcl and Tk that is freely available over the Internet. Additionally there are some commonly used
reference books including “Practical Programming in Tcl and Tk” by Brent Welch. The remainder of this manual will
assume that the reader has some familiarity with Tcl – familiarity with the Tk extensions to Tcl is not necessary.
The
Tcl Shell
is purely a command entry and command-line program execution shell that does not support GUI
application development. It supports keyboard entry, mouse operations, and shell configuration in a manner consistent
with the host command shell (e.g. Windows “cmd” shell or Linux “terminal” shell). It supports interactive user
prompting (via “standard input”) from a script.
The
Wish Shell
is a newer shell designed to enable GUI application development. PowerShell Wish uses the top-level
window created by the
Wish Shell
to present a “Close PowerShell” button since the console window opened by
Wish
is subsidiary to the top-level window. As with the
Tcl Shell
, the
Wish Shell
may be used either for script execution or
interpretive command execution. PowerShell Wish must be used by any applications or command sequences that
produce O-Scope traces since these require the Tk resources available under Wish.
4.1.1.
Tcl Versus Wish in the PC Windows Environment
On Microsoft Windows systems, when a
Tcl Shell
is opened, users may right-click on the title bar to set properties for
the console shell. Generally, PC users will benefit from configuring the shell properties to support “QuickEdit” and
“Insert” modes. Text may be copied using the mouse to select the text and pressing [Enter] on the keyboard. Text
may be pasted by using the mouse or cursor keys to position the cursor and then right-clicking the mouse.
Wish is more “Windows-like” in that users may use typical methods of selecting, inserting, deleting, and copy-paste as
are used in other Windows applications. One limitation with the
Wish Shell
under Windows is that any applications
utilizing command-line prompts to the user will not function properly since Wish is will not take “standard input” from
the command shell. However, user dialog using graphical message boxes is readily done within the
Wish Shell
.
4.2.
PSA Connection Dialog
When either PowerShell Tcl (
figure 4.1
) or PowerShell Wish (
figure 4.2
) is opened, the user will be prompted via a
command prompt (Tcl) or via the PSA Chassis Select window (Wish) to select a PSA address to connect. The dialog
will validate that the desired PSA is available on the local network
and then connect to that PSA. If the PSA is not available or is not
powered, the dialog will refuse that connection. If all known
PSA’s are found to not be available, PowerShell will open up in
Demo Mode meaning that all instrument control becomes “virtual”
– that is to a fictitious PSA. The PowerShell TCL prompt will
time out if given no response in just under 10 seconds, at which
time it will attempt to re-connect to the last successfully connected
PSA address.
Figure 4.1
PowerShell TCL Connection Dialog
Summary of Contents for PowerSync PSA100
Page 26: ...PowerSync Analyzer Reference Manual March 9 2010 Sifos Technologies page 26 ...
Page 56: ...PowerSync Analyzer Reference Manual March 9 2010 Sifos Technologies page 56 ...
Page 84: ...PowerSync Analyzer Reference Manual March 9 2010 Sifos Technologies page 84 ...
Page 110: ...PowerSync Analyzer Reference Manual March 9 2010 Sifos Technologies page 110 ...
Page 120: ...PowerSync Analyzer Reference Manual March 9 2010 Sifos Technologies page 120 ...