Example of a JScript 9 h/ N3 ]9 v* `0 b& n7 Q' R& @
var vbOKCancel = 1; * `" C) I! s7 ?
var vbCancel = 2; 7 Z' O" ]' q1 M# g) W3 }
var vbInformation = 64; ! N& C8 y/ q9 Y( y
var Finished=false; ! Z# T4 _0 i; e
* l* a- e$ {1 k, \& zvar WSHShell = new ActiveXObject("WScript.Shell");
( L: Z$ x* ^$ i1 v/ Q3 s* O4 T( @4 { 6 g0 T0 O, {* f" i
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
6 Q$ x* p# q, X% ~ , G7 K% {2 s) ? B8 V4 o7 c% R
simple.SetLicenseType("Runtime"); $ H* J+ U- ?% D
7 {7 s, N( S( S4 h [# ctry 1 P- ?6 k# R6 h9 G" K0 K+ e
{
8 G; F$ A! N4 e+ z4 Z // Enter the path to a model file!
' c( D' s$ I# m$ L, ~ simple.LoadModel("C:\\Models\\Test.spp"); & G B5 v+ b* ^5 j4 c) |
} , b# B2 T/ T/ F( x6 Y
catch (e) : X2 R" V+ [5 @( z
{ ; l. Y" X) `0 K1 J3 V
WScript.Echo("Could not load Model!");
3 I# y" A4 s+ E6 K8 ] WScript.Quit(); ; t; U' S' S1 m
}
4 h5 i0 x4 r: F" S, ^ : F: y8 X' a- L% Z! y/ ]/ p
try
; O3 q( C- O- W; p$ B" D{
" z3 S+ p3 P% F$ q# O$ ~ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { / A- N3 S! O n. A5 k( b
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 2 i+ X5 r0 _2 s6 p: j
if (r == vbCancel) 3 m9 ^8 V, L! }/ d
{
7 b% b6 Z+ I+ V5 h3 u9 V simple.CloseModel(); ' }+ I N+ l! x+ r8 z' Q, `2 R
WScript.Quit(); . o, D0 v- l( B- A
}
: E* N: U' M1 s1 m, {* [: V4 T}
7 Z+ Z# ^+ {1 y! f2 r2 Y0 l & r: s5 z p% r0 m4 u
simple.StartSimulation(".Models.Frame.EventController");
$ U+ Y/ c5 [9 j# e! m( Y V
" Y% A1 x" A% l8 H' u" M3 X. zif (simple.IsSimulationRunning()) e* b5 V( R0 t' p* L8 ^
WScript.Echo("Simulation is running!");
2 j1 x" K# T! v2 ?0 _2 P , H/ d; X3 i$ h9 a; Z( T' a
// Wait until simulation is finished
% c& l- p, ]7 q% |' wwhile (!Finished) WScript.Sleep(2000); 9 N; a0 O3 Q2 m5 q6 \
2 c/ @7 k" M' g: }6 Msimple.CloseModel();
6 D4 I7 H+ e( G. S, esimple.Quit();
" W- Y1 J: B5 q) m# d. s8 h0 P5 ^WScript.Quit(); / p2 q2 Z' F" W" c& H
5 x% d5 l! Q8 G' I9 T5 x0 Q# \5 Z* D ! i# b& M0 s& u& d
function RemoteControl_SimulationFinished()
6 P! z, ?' L7 T7 d{
" N+ w7 | n* ^# {$ V/ n2 A WScript.Echo("Simulation Finished!"); |