Example of a JScript
\" o1 q! ]2 F3 ovar vbOKCancel = 1;
. W# C# N4 A2 A$ E' E, e& B2 e/ wvar vbCancel = 2;
% Z5 Z& }6 I% B* Uvar vbInformation = 64; / c% Z; T L- W- g1 O
var Finished=false; % Q+ n9 R$ h) }* m
2 j7 ?4 `7 ]+ a3 ?6 P+ Z& |6 J* nvar WSHShell = new ActiveXObject("WScript.Shell"); + D' f% [6 h4 ?/ r. k5 j+ i
) x8 @8 f# s* O# mvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
% k" u$ k% L4 G, b1 T5 D% X
1 s( v) U0 F& x4 {; x% {" ?+ Z8 Usimple.SetLicenseType("Runtime");
R+ a; Y/ K# \3 V( m! m / z3 x m9 N& u6 \- {: R6 b
try ) P x3 |) y1 S% H5 G* [: R$ p: {
{ % L+ E" b6 U$ D, q0 y5 e: k
// Enter the path to a model file!
5 S# o8 g& Y2 Y4 o simple.LoadModel("C:\\Models\\Test.spp");
: l4 w- F- a, J' w} + F, x! I6 e6 p2 N7 Q# A. m/ p
catch (e) 0 B) a% [ i7 G' `+ F! W1 \* ~
{ + I S, Q' M q* p/ {
WScript.Echo("Could not load Model!"); ! k4 N, r. I( r$ J" K& `
WScript.Quit(); 2 Y- _2 H5 r& Z! S: m
}
/ o% _! Q" |. p& d% x; C . k4 T' M: t9 |4 k" F
try 3 a6 w! q9 F7 @: \# f
{
) Q" Q0 ^# a0 x( b1 R. x' t simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { : E. u1 M: [5 e# G* r! y2 a
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 4 x6 ]/ n$ T" s7 }' r _
if (r == vbCancel) 4 V6 }8 [" l) ~, B9 l6 C! R( Q, j
{ - s, z8 b1 Y8 h( n
simple.CloseModel(); . p q- ?$ r2 X {/ s; y" c1 e! ~
WScript.Quit(); ( I. j3 a1 `+ a% g
} j5 I) G: d, I5 z8 Z% e
} ; O2 `( Z! U' B3 ]
( R1 z) T' s+ o% z: Usimple.StartSimulation(".Models.Frame.EventController");
9 E9 L1 A5 N8 @! W
7 }. Z( G" B' Mif (simple.IsSimulationRunning()) 6 r0 H S4 a; l3 X6 a
WScript.Echo("Simulation is running!");
' H5 T Q8 d1 r; x3 ]
1 ?# S. l9 c3 ?) s// Wait until simulation is finished $ t# O* Q2 }6 A9 r7 _
while (!Finished) WScript.Sleep(2000); & M, b, J; U Z# m3 m: u8 t7 X
* ]/ N' g% H" i1 t
simple.CloseModel(); . T8 ?2 }" A7 S- u% |+ |
simple.Quit(); / x- K" Z/ F- _
WScript.Quit(); ) e, k! o* f6 Q4 s) d* W
/ y' D5 ]' }% S; B, s( b : S. O( y# X- h' |$ p i* R
function RemoteControl_SimulationFinished() 5 M# a% T9 p8 e+ \. h6 U, S
{
( }+ E" [! d% N; H! b7 m WScript.Echo("Simulation Finished!"); |