Example of a JScript
% {7 o+ v1 _: B% G8 V/ x/ o4 avar vbOKCancel = 1; 8 Q" J" @6 p+ l
var vbCancel = 2; % [5 ?* o/ K6 g7 M; k( F. t4 P
var vbInformation = 64; 7 \$ X5 }, c( t1 } {/ s1 G
var Finished=false;
% v. Z' r1 Q5 _ S) B: c
/ y* Q, V/ M2 g; N& _1 X9 A. mvar WSHShell = new ActiveXObject("WScript.Shell");
y; I$ B4 O4 B1 D: {% W5 Z3 S ^. |+ x5 `8 Y
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
' O! ?$ a+ A6 M- O 2 ]+ U4 S1 G* V# g8 g2 R" ]0 d
simple.SetLicenseType("Runtime"); " v- d- m) _; l$ a# U8 F1 c6 l% P& q/ Y
& O" i* C7 o0 {! r' V$ l v5 Ytry
2 A |7 i& g& X! u f{ ; `0 O" s1 i9 C$ |3 {0 c! \, y
// Enter the path to a model file!
# N6 q/ h& B' N. z; W2 e simple.LoadModel("C:\\Models\\Test.spp"); # p/ Z, m$ J' i5 `0 x Y
}
4 f) f; y' ?+ H3 Z8 Ecatch (e) & v; ^# s) V" _$ ]4 U1 Q6 @
{ 1 P% O7 j+ J8 V* o* E4 P
WScript.Echo("Could not load Model!");
/ @3 W! \' q& N! o+ v! d2 W! s WScript.Quit();
! ^: `! x& ~8 P# t2 J} & r0 I' X& f+ ^
) n4 |. L, G3 h+ g4 ntry
2 x3 _$ o; @ c Z% H{ - i) Z% ]5 D4 E( c
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
- O( [6 r! T, q" o) \$ g r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); . q$ \2 F0 _2 `, O
if (r == vbCancel)
% a# v `5 t# J' E* V9 ]4 k {
5 J6 r2 I7 P" F3 ]2 S. X; W simple.CloseModel(); , }3 I( {) L2 c& N
WScript.Quit(); ! Y( I+ B/ Y, X1 E' b
} ) C' K9 R7 @. b9 y- B
}
5 ^4 K8 k6 k8 m . G7 A; p3 _5 i w( T/ H/ [" S1 Y
simple.StartSimulation(".Models.Frame.EventController"); # D1 j3 o X7 d3 J d# Y
& j' P: b( r5 A/ N3 K
if (simple.IsSimulationRunning())
8 N! q( S- Y( @8 ^4 F+ s WScript.Echo("Simulation is running!"); 8 r2 C* _4 }# g# M# d
' ]5 R) l' p5 }' T. a6 z7 ]" x. b
// Wait until simulation is finished
+ n6 a( A) {8 K" owhile (!Finished) WScript.Sleep(2000);
b/ a9 \" }& ~) W3 O
. ^) H! A& j2 E) Csimple.CloseModel(); 4 s0 V5 T" ^. h* P! n% g9 @
simple.Quit();
5 `( N s( [& RWScript.Quit(); J# A2 M% f9 b% J0 Z- p
+ ^; K" z1 j8 V- q4 Y
) h1 [* u) n3 Bfunction RemoteControl_SimulationFinished() , J/ R( r) O( q7 }* l
{ / H, b4 @, q6 t& o
WScript.Echo("Simulation Finished!"); |