<< Click to Display Table of Contents >> SpecView: Run External Program |
![]() ![]() ![]() |
This Button/Strategy Controller Action will start another program.
SpecView can only run programs with the filename extension .EXE, .COM or .BAT and the program's filename must be specified in full including the extension. SpecView cannot run shortcuts (which are of type .LNK).
This command has the ability to accept the name of variables in the line. Each variable should be enclosed in double-percents, like this, showing an example of using SpecView.Time:
%%SpecView.Time%%
Another example, run the program 'C:\TEST.EXE' passing in the number contained in 'Zone1.PV':
C:\TEST.EXE %%Zone1.PV%%
You can have multiple variables, as long as they are always enclosed in the double-percents
If a program is specified without the full pathname then SpecView will first assume the program is in the current project's folder, for example, C:\SV3\Furnace
If it is not there, then it will use the PATH setting to find the program, alternatively specify the full path, see examples below.
NOTE: Put double-quotes around any commands or commandline parameters that contain spaces.
Some examples of these are:
MyCommandFile.bat MyData.CSV
'C:\My Utilities\SendText.EXE' -n07777555666 'The furnace is overheating'
C:\WINDOWS\COMMAND\XCOPY32.EXE 'C:\My Documents\Sample.doc' C:\Temp
Program Launch Failed; WExec error code = 2
This error will occur during Runtime mode if the program name has been incorrectly specified.
WExec error code = 3 - The path for the file has been incorrectly specified.
WExec error code = 11 - The file specified is not in valid EXE file format.
NOTE: Programs will be run minimized by default, see below:
The reason that the default setting is Minimized is because this command was originally added in order to run programs to, for example, play a sound file, where it would be inappropriate to display the program's window.
It is possible to change this in the SETTINGS.INI file in the project's folder:
[Settings]
Where the choices are:
M - means start Minimized, which is the default
F - means start using Full screen
N - means start in a Normal window
This setting will affect all programs run by SpecView from that project.
As of Version 3.1.251, it is possible to specify the path to the SV3 folder with, "%%SpecViewInstalledPath%%, and the path to the project folder with, "%%SpecViewProjectPath%%.
For example, "C:\SV3\CriticalAlarm2.wav" can be replaced with, "%%SpecViewInstalledPath%%CriticalAlarm.wav".
This is convenient for when SV3 is not installed on the Local C drive of the PC but else where.
This string will prompt SpecView to look for the external program in the installed location.
For example, a user intends to use SwithMail.exe to send emails.
The user can do this in SpecView with the Button Attribute or Strategy Controller Action of Run External Program.
In the Run field of Button Attribute or Strategy Controller Action, the path to SwithMail.exe would be entered.
If SpecView was installed on the Local C drive of the PC, then the path would be "C:\SV3\SwithMail.exe".
However, SpecView does not always get installed to the Local C drive.
Users can alter the location of SpecView's installation.
In situations like this, it is preferable to use the string %%SpecViewInstalledPath%% to point SpecView to the SV3 folder in the installed location.
This string points to the Project Folder within the SV3 folder.
For example, a user wants to open a PDF that contains help for the current project in SpecView.
The PDF is stored in the Project Folder.
The user can do this in SpecView with the Button Attribute or Strategy Controller Action of Run External Program.
In the Run field, the path to the PDF would be required along with the Explorer command.
If SpecView was installed in the Local C drive of the PC, then the path would be "C:\SV3\Test\Test.pdf".
The name of the project is Test.
However, SpecView does not always get installed to the Local C drive.
Users can alter the location of SpecView's installation and therefore alter the location of the Project Folder.
In situations like this, it is preferable to use the string %%SpecViewProjectPath%% to point SpecView to the Project Folder.