Launch a different WindowViewer application from a running WindowViewer application
Last updated: February 20th, 2025Description
- Author: Brian Schneider
- Published: February 20th, 2025
Details:
Description
Discusses how to add scripting to an application to shutdown a running InTouch WindowViewer application, and launch a different InTouch WindowViewer application.
Pre-Requisites
You must have InTouch already installed, and two applications which you would like to switch between.
Detailed Steps
This solution will involve using batch files to load a new application after WindowViewer has been shut down via a script.
- Creating a button in InTouch to start the other application.
- Open WindowMaker and create a button on the screen. This button will be used to shutdown WindowViewer and load the alternate application.
- Double click on the button to open the animation links.
- Select Action Script and configure it as shown:
- Create a batch file to launch the alternate application. (There will be one batch file for each alternate application)
- The following script will use the Ping function to wait for a few seconds, giving WindowViewer time to shutdown, then will start the specified WindowViewer application.
- The following script must be configured. You will need to specify the path to InTouch WindowViewer, the path to the application you want to run, and the amount of time to wait before launching the new application. These will be configured in the “Settings” section.
- The following script will use the Ping function to wait for a few seconds, giving WindowViewer time to shutdown, then will start the specified WindowViewer application.
Copy and paste the following information into a batch file, and save it to C:\LaunchApp2.bat, or use the attached file.
@REM ***** COMMENTS *****
@REM Purpose:
@REM This batch file will wait for a specified amount of time, then launch InTouch WindowViewer,
@REM specifying the particular application which should be run.
@REM
@REM Configuration:
@REM To use this batch file three settings will need to be adjusted in the SETTINGS portion of the file.
@REM 1) InTouchPath (Found below on Line 28)
@REM The path to where InTouch WindowViewer is installed on the computer.
@REM - For 32bit systems the default is "C:\Program Files\Wonderware\InTouch\view.exe"
@REM - For 64bit systems the default is "C:\Program Files(x86)\Wonderware\InTouch\view.exe"
@REM
@REM 2) ApplicationPath (Found below on Line 29)
@REM The path to the InTouch application you would like to run.
@REM - Example: "C:\MyInTouchApps\App2\"
@REM
@REM 3) WaitTime (Found below on Line 30)
@REM The amount of time in seconds to wait before launching WindowViewer.
@REM - Example: 10 will wait 10 seconds.
@REM
@REM **********************
@ECHO OFF
CLS
setlocal
@REM ****** SCRIPT ******
@REM ** Modify these values for your specific application ***
SET InTouchPath="C:\Program Files\Wonderware\InTouch\view.exe"
SET ApplicationPath="C:\MyInTouchApps\App2\"
SET /a WaitTime=10
@REM **********************
@REM ****** SCRIPT ******
@REM ** DO NOT MODIFY ***
ECHO WindowViewer will be restarted in %WaitTime% seconds.
ECHO.
SET /a LoopCount=0
:LOOP
IF %LoopCount% == %WaitTime% GOTO STARTINTOUCH
PING 1.1.1.1 -n 1 -w 1000 1> nul 2>&1
<nul (set/p z=".")
SET /a LoopCount=%LoopCount%+1
GOTO LOOP
:STARTINTOUCH
ECHO.
ECHO.
ECHO.
ECHO Launching WindowViewer
%InTouchPath% %ApplicationPath%
@REM **********************