|
|
Graphical user interfaces
The graphical user interfaces (GUI) capability is one of the most important parts of FastTrack Scripting Host
and is one of the things that makes it very different from all other scripting languages.
User interfaces are important because that is what users see, and based on what they see,
they will make judgment of your work. They cannot appreciate your implementation
details of a script; they can only judge your work by what is presented to them.
Traditionally scripting is GUI-less for a number of reasons. One being that few network
admins have any graphics skills or sense of good form layout at all. FastTrack Scripting
Host has pre-build professionally looking user interfaces that can all be used simply by
writing a single script line - and with your company name on them.
|
The content on this page is valid from FastTrack Scripting Host version 6.5. Most user interfaces
can be seen in the live video of the demo script. Click the blue demo script button to the
right to watch the demo script that ships with FastTrack Scripting Host.
|
|
|
ShowMessage command
The ShowMessage command is probably the most commonly used graphical user interface and
is used to show a basic message. ShowMessage must be supplied with a message to show, and
can optionally be supplied with a header caption and an icon name. In its simplest form,
a ShowMessage script line can look like this:
 |
|
ShowMessage
Installation complete.
|
 |
The ShowMessage will by default have the header caption of "Information" and a default
icon is used. Our script line above will look like this:
 |
| ShowMessage Command |
Icons
Most graphical user interfaces use one or more 64x64 pixel icons and each interface is using a specific one by default. The icon used can
always be overruled simply by giving the name of another icon as a parameter. The icons that are possible to use, can be seen in the script
editor by selecting the "Icon Explorer" tab that is by default located as a tab next to the Context Helper:
Custom icons can be included by using the AddCustomIcon command. Icons must be 64x64 pixels (or less) and preferably in png format.
In the case of ShowMessage, a third parameter can be supplied that contains the name of an icon to use instead. This means that for
instance "Screen" can be appended to our initial ShowMessage example like this:
 |
|
ShowMessage
Installation complete.,Information,Screen
|
 |
Our message now uses the "Screen" icon instead, as shown to the right below.
 |
 |
| ShowMessage Command - Default Icon |
ShowMessage Command - With "Screen" Icon |
The company name
Most user interfaces on this page have a company name note, as is the case above with ShowMessage.
The name "Acme Corp Ltd" is replaced with your company name, so if your company name is "Rock America",
the interfaces will have a "Rock America" note printed on them instead.
By default the company name will be the company name from your license key, but the name can be overruled with the
SetCompanyName and SetDefaultCompanyName commands. If preferred, the text can be removed in general by using the
DisableCompanyName command. Using these commands will have effect on all subsequently shown user interfaces.
ShowErrorMessage and ShowWarningMessage command
The commands ShowErrorMessage and ShowWarningMessage are the same as ShowMessage, except that
they use a different pre-selected icon. A simple example could look like this:
 |
|
ShowErrorMessage The installation
of Microsoft Office 2010 has failed.[Return][Return]Please contact HelpDesk.,Installation Failed
|
 |
Note how the Return function is used to break the text into multiple lines.
Our example above will look like this:
 |
| ShowErrorMessage Command |
Menus
The Menu function is used to present a list of choices to the user and perform an action
based on the choice. The menu function takes a list of parameters and each parameter can
be prefixed with an icon name, in which case icon name and display value must be split by
a pipe sign. The example below is from the demo script that is located in the installation
directory of FastTrack Scripting Host. For simplicity, only the first three menu items
are included the script below.
 |
|
Set WebDoc=[Menu
Select a topic of interest,Find|Documentation Overview,Getting
Started Guide,Defrag|Working With Logical Paths]
|
 |
The first parameter is the caption and the next three parameters are the first three
menu items. Items one and three are prefixed with the icon names "Find" and "Defrag" before the
pipe sign to overrule the default icon. The full script line from the demo script that uses the Menu function looks like this:
 |
| Menu Function |
Another example of using a menu actively is the HelpDesk Application
example that looks as shown below. Please click
here for script details.
 |
| Menu Function |
ListMenu function and List command
If a list is preferred over a menu with graphical icons, the ListMenu function
can be used much the same way, except that it does not have the option of icons.
The List command is the same as the ListMenu function except that is does not
return the selection.
A list menu has an icon at the top, which can be overruled with the SetMenuHeaderIcon
command. In the example below, the "Printer" icon is selected to overrule the default
icon.
 |
|
SetMenuHeaderIcon Printer
Set Location=[ListMenuForced Select location,Main
Building - Conference Room,Main Building - Sales Office]
|
 |
The example above will display a list of printer locations and then printers should be
connected based on the selected location. Expanded a bit, the above example would look
like this:
 |
| ListMenu Function |
The variable "Location" will contain the full name of the selection. When working
with the Menu function, variables will naturally be short, but when using ListMenu,
the listed options can be long and unfit as variable values. If the returned
variable value is preferred to be different than the displayed value, values can be prefixed with a variable
name and a pipe sign. If the value "Reception" was specified as "Rec|Reception", then
"Reception" would be shown, but "Rec" would be the value of the location variable, if
"Reception" is selected in the list.
The default selection can be set with the SetMenuDefault command prior to using any
type of menu. In this case, if the previous printer location was saved to registry,
then the last selected location could be selected by default. Menus are not sorted
by default, but sorting can be enabled for any type of menu with the EnableMenuSorting
command.
DoubleListMenu function and DoubleList command
DoubleListMenu is similar to the ListMenu function, except that the list of values must
be in pairs of two, where the left-side value is returned as the selected value.
The first parameter is the header text and the next two parameters are the
left and right column header names. All subsequent parameters must be in pairs of two
as the list to display, meaning that every second value is displayed to the left.
The DoubleList command is the same as the DoubleListMenu function
except that is does not return the selection.
The script listed below is a modified version of the documentation menu from the demo script.
The list of choices is stripped down to the first and last option for readability.
 |
|
Set WebDoc=[DoubleListMenu
Select documentation item,Name,Description,Docs|Online
documentation,Exit,Exit the demo script]
|
 |
The header can be changed with the SetMenuHeaderIcon command, as explained the previous section with ListMenu.
Selecting "Documentation Overview" will thus return "Docs" in the WebDoc variable,
if selected. The full script line from the demo script looks like this:
 |
| DoubleListMenu Function |
Progress command
The Progress command is used to show the progress of a lengthy process with multiple steps, for instance an installation.
The progress command is expected to be called a number of times during execution to update the percent completed and
optionally the caption and body text.
 |
| Progress Command |
Below is a slightly tweaked version of the progress lines from the demo script. The sleep statements
are there only to simulation consumption of time instead of doing actual work. The first parameter is the
only mandatory parameters and updates the progress completion percent. The rest of the parameters are for
optional updating of the header caption, body text and the displayed icon.
 |
|
Progress 0,Preparing installation of the Acme Corporation software.,Installing Acme Corporation
Software
Sleep 4
Progress 20,Installing the Acme Corporation software.[Return][Return]Remaining time:
Approx. 4 minutes.
Sleep 4
Progress 60,Downloading updates for Acme Corporation software.[Return][Return]Remaining time:
Approx. 2 minutes.
Sleep 4
Progress 80,Applying updates for Acme Corporation software.[Return][Return]Remaining time:
Approx. 1 minute.
Sleep 4
Progress 100,Cleaning up...
Sleep 3
RemoveProgress
|
 |
Version 7.1 has introduced a related command called ProgressTo. This command will
set up a timer that will gradually increase the shown percent within a certain
timeframe. This is useful for installations, where it is possible to make a qualified
guess of the total time that will be consumed before the installation is complete.
Splash screens
A splash screen is another method of telling the user that something is going on, usable for
for instance a logon script as shown
in the movie here.
There are two splash commands: Splash and SmallSplash, as shown below.
Splash can be skinned by giving the name of an image skin file or an icon file
that must be up to 128x128.
 |
| Splash Command |
 |
| SmallSplash Command |
Ask condition
The Ask condition asks the user a question and the condition will then be entered only
if the user selects "Yes". An example Ask condition could look like this:
 |
|
If Ask Would
you like to see the online documentation?,Demonstration
complete Then
|
 |
The first parameter to Ask is the message/question. Header text and icon name can optionally
be supplied. In the example above, the message/question and the header text were set
and it looks like this:
 |
| Ask Condition |
Input and InputPassword functions
The Input function asks the user to enter a text string. The InputPassword function is the same
except that is hides the text entered in the text field and a different icon is shown by default.
In the demo script, the Input function is used to ask the user to enter job title:
 |
|
Set Title = [Input Enter your job
title]
|
 |
The header text and icon name are optional parameters and in this case we have only supplied
the body/question text and the default "Information required" is used as caption:
 |
| Input Function |
MultiInput command
The MultiInput command is used, when more than one value must be entered. The first parameter is the
header text and all subsequent parameters are presented as separated fields. When MultiInput is closed,
a variable will be created for each field with the caption as the variable name. If a different variable
name is preferred, the field name can be split by a pipe sign, where the left part is the new variable
name and the right part is the displayed name. The example below is from the
HelpDesk Application example, where the UserName parameter
is split.
 |
|
MultiInput New
User,UserName|User name (Initials),First name,Last name,Password
|
 |
The above script line in action looks like this:
 |
| MultiInput Command |
ShowWebPage command
The ShowWebPage is used to show a web page to the user and halts the script until the user clicks
OK. This can be used for instance in a logon script to show an intranet page to users once or
once a week. The demo script shows the documentation overview page from this web site, which
looks like this:
 |
|
ShowWebPage
http://www.fasttrackscript.com/Docs,FastTrack Scripting Host
Online Documentation
|
 |
This example will look as shown below - observe that the screenshot is scaled to 50%. On the
executing computer, the windows will scale to fit the screen resolution.
 |
| ShowWebPage Command (Scaled to 50%) |
ShowRemoteDesktop command
FastTrack Scripting Host can from version 7.2 act as a remote desktop client. You can for example create a menu with choices and
then upon a valid selection show the correct remote desktop with the ShowRemoteDesktop command. Once the user
clicks the "Close" button, the script continues.
 |
| ShowRemoteDesktop Command (Scaled to 50%) |
The script to produce the above result looks a shown below, where the name "FastTrackServer" is an internal server.
For a full-screen remote desktop, the ShowFullRemoteDesktop can be used instead.
 |
|
ShowRemoteDesktop
FastTrackServer,FastTrack Remote
|
 |
SyncDir and CopyDir commands
The SyncDir and CopyDir user interfaces are listed under "Directories" in the engine browser, because it
is a user interface that is the result of the I/O operation. For more information on SyncDir and CopyDir,
please click
here. SyncDir in action looks like this:
 |
| SyncDir Command |
|
Copyright 2005-2012 FastTrack Software
|
|
|