Example of a JScript
! N0 Q' g; }+ z: k. V6 uvar vbOKCancel = 1;
5 m i; c: Y) e9 u: [$ Xvar vbCancel = 2; 0 P! ]( k+ \ ^) T# [, [
var vbInformation = 64; & ], Q# i2 q! q
var Finished=false;
) `( q* z- U0 m' [ 1 Z' m `" m# T/ S( O+ l4 g6 I
var WSHShell = new ActiveXObject("WScript.Shell");
0 }2 G/ F6 c0 q: S9 ?1 E0 G * p0 f8 ?' K. H0 m) [" h
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
' j( ?% S7 z2 p P
: S. l9 s) @: d. u6 b' i& t) Zsimple.SetLicenseType("Runtime");
6 r& v$ c2 N3 {3 ?4 c! `
1 F9 v! G' Z+ `. S" d stry . ]/ |6 J/ o* T' M2 f5 @
{ 5 Z5 w6 E6 x: n
// Enter the path to a model file!
5 v; v/ [0 ]; s5 P1 o) ]8 y simple.LoadModel("C:\\Models\\Test.spp"); . j, _ Y1 b0 W+ A0 v* T4 Y
} , D8 t: {! n& k b' C8 y8 a9 @
catch (e) ! N+ c* K# D4 f) y9 O
{
# A2 N* e5 M v1 I% \ WScript.Echo("Could not load Model!"); $ O- B; t% a& B4 A/ b
WScript.Quit(); ! ?" ]% Z) Y4 K: t, O! D1 N
}
% h; k6 ~ o4 t" a8 @ - `& ^. G& ]' @$ y5 V; k8 Q" [0 _4 m
try
+ u n) Q) y' f+ }{
# Q: J9 ?4 y! N# Y1 ? simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ( w$ H+ z3 W% w$ T8 ?2 o2 x6 U3 Y4 N
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); . y# ?4 m! g6 m6 v! |
if (r == vbCancel) 8 ^8 m* M: K; o5 T- d3 @% t" M# q
{
6 @8 f7 Z3 V# h; x simple.CloseModel();
/ F' z* s2 N; b! r8 K$ F3 R% _ WScript.Quit();
# P: \6 ~/ g) }+ b }
, N1 ^5 Z* C9 h( q# N9 n) P( t}
7 l# M9 X1 _0 J* |: h* L: u, f) [* q0 O ( X; k2 q# [1 C1 Z+ K6 A, f% m
simple.StartSimulation(".Models.Frame.EventController"); : q$ e# l) x' [/ s) Z: x
! i C! m+ l/ B9 k6 y! l: @2 L8 x% z) Iif (simple.IsSimulationRunning())
$ q& l: _/ }, g* h8 m n8 m WScript.Echo("Simulation is running!"); 7 e2 f$ t. V4 n/ ]7 g
% A& a" _8 J/ {5 d6 g// Wait until simulation is finished
0 O4 u9 _( |1 U3 l# {while (!Finished) WScript.Sleep(2000);
- J9 N9 K7 m( i1 w* P ) g0 P! n" ?. l. l* n, E) _
simple.CloseModel(); 8 d/ i+ o' j0 H& D3 D8 u% j
simple.Quit(); 3 l, Z8 S0 F/ a
WScript.Quit();
! o+ B+ m% I* J/ @6 D' r* L + p0 ^1 S! F4 s
9 f. D, h" h/ s# }
function RemoteControl_SimulationFinished() 4 f3 R4 X* |) A/ m1 t( A
{ : r# t4 f$ C& _% j
WScript.Echo("Simulation Finished!"); |