Example of a JScript - I& _+ y6 x9 {- U9 L
var vbOKCancel = 1; 2 l* F' J6 i: v4 ?3 h# f( y8 e
var vbCancel = 2; ' m6 s+ B4 Z3 B* { g6 o
var vbInformation = 64;
: W" a9 a# v# j; m' f) ovar Finished=false; 2 s: d2 T" o5 x+ z8 F. s
* {! U) e: E, T5 c7 j* e/ d: }
var WSHShell = new ActiveXObject("WScript.Shell");
5 u: ~ p; R/ C! z3 ^2 S
$ j$ i$ L9 K4 vvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ( F8 T0 }( f" \5 c# P' d, `0 e
6 g7 J5 e- A. z. A
simple.SetLicenseType("Runtime"); # U! ~0 o. c$ G7 c1 Q1 n2 U+ D
5 t, _) Q8 x2 S2 P; s9 \. ftry
% y Z; R3 t& O8 J{ : H* B1 D: p( E: G2 r1 ?
// Enter the path to a model file! 5 ~, X% N& C; F' b- t8 N) S% v7 M
simple.LoadModel("C:\\Models\\Test.spp"); ( p# i! W; S, I) L
}
% \/ K& f- P' |$ Ucatch (e) ) M- d% F1 @. z h" T
{
: O! V ^4 p+ `8 U3 b w0 P, K2 Y WScript.Echo("Could not load Model!"); 3 v$ {1 N( I! g; i* l
WScript.Quit();
# N+ O* v7 M- d4 A1 `9 X}
* w. j$ {; L1 ]3 F2 Y 6 K: U6 E1 h3 S0 i/ p2 K" ]
try 9 n* T: ?0 Z" H
{ , g5 Y5 d3 o8 X/ ?
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { - V" _/ N' ]' N5 N$ F5 O2 d( b
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
5 D2 c% c q! w; K" \/ n0 H if (r == vbCancel) 0 l2 r% U' ^3 S. m4 R8 A" C
{ ! j. g/ @! j: y
simple.CloseModel();
6 G. L& I. P- p4 q WScript.Quit(); 8 m6 e" M) b! X5 F# J) W0 u2 L
} : b, C, o# w! P% @5 e4 Y
}
1 V `* |, y6 K! h' p7 M% n ) t! t+ @8 M, P1 S7 d P
simple.StartSimulation(".Models.Frame.EventController"); - N3 x8 @' S8 [' h
3 L( Q5 o0 d5 f7 @if (simple.IsSimulationRunning())
4 a& M+ N- ^& p5 _, A8 o WScript.Echo("Simulation is running!"); 8 H: U2 t7 d' K
, a6 r" G6 e p( X% T. n
// Wait until simulation is finished $ V' \8 b. R9 z4 w* K( a' T
while (!Finished) WScript.Sleep(2000);
( ]. v) B, O, f1 N3 z$ H " k! l/ m h: o" r) \; C! e
simple.CloseModel(); # z) N/ v! a' T/ [
simple.Quit();
4 t+ c4 W: F/ `3 kWScript.Quit(); , O3 a1 D! Q" S
. d3 A5 G1 T/ X$ G: L
, B- C" p$ I0 q9 a; L7 s
function RemoteControl_SimulationFinished() 8 T$ \% D7 w; j( u0 H
{
2 S/ |5 y. K" \7 X& L WScript.Echo("Simulation Finished!"); |