Example of a JScript
: @- p/ k9 E* N' t& hvar vbOKCancel = 1;
; F8 Q, b5 a+ uvar vbCancel = 2; 2 J* y. F% k8 S7 y; H" b
var vbInformation = 64; % X/ B: J1 |* l- C e
var Finished=false;
7 B+ _; T' }( x+ ` U, l! R. ~% E
var WSHShell = new ActiveXObject("WScript.Shell");
- ?! x$ Y7 h( j) I. A; @
; \4 g, q# X" t/ k3 p9 v( C5 xvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); : q; ?! s# r0 p
7 B* Y; A4 n! s, Usimple.SetLicenseType("Runtime"); ' g1 F% y! L% H2 R; A4 u, ~
( P. S3 O9 e4 q1 `
try 2 g8 ^( s: {! Q+ {5 ^. f
{
* N: ~/ i, O) K // Enter the path to a model file!
8 g( g, F- W/ g S2 N! F- U7 V simple.LoadModel("C:\\Models\\Test.spp"); / ~ F) i7 F$ x2 Q, L% r
} " v5 N3 e3 \& e1 {; `9 ^
catch (e) - k2 @6 k) h' c V0 B$ }+ D* T
{ : z/ y* l- M2 T2 j/ P$ {/ J
WScript.Echo("Could not load Model!"); 4 }2 a4 v6 ?5 y, ?+ O5 H
WScript.Quit(); ' h# |5 L% v! u* p
} ) S% H6 J4 V0 g$ ^1 C* d+ ~. @6 r
! g0 s& A! y, q+ W2 N
try 4 e% u+ H6 s6 o9 A
{
; ^% j2 P& l; W6 M simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 6 p* t' N+ x2 ~( r. E, N
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ! _4 U: u2 {& X% z( E+ F' o
if (r == vbCancel) ' [$ M' _' l `& }: Y) n
{
+ t. ]/ X& S% { simple.CloseModel(); 4 g2 X% G+ Q9 C0 `$ D
WScript.Quit();
1 |4 u, v- n* z4 R# p% G } 0 q& |5 j7 d" x2 K' Q) N
} 3 m: J2 b, s! x- }
) N+ |: ~- k; W7 |! hsimple.StartSimulation(".Models.Frame.EventController"); 4 ~+ ^( {& h7 M0 N0 ]7 h' a/ a
6 K( [# p1 M1 L V
if (simple.IsSimulationRunning()) 2 ?# E- X2 t, [0 u" o- t/ v- G
WScript.Echo("Simulation is running!"); 7 r$ U. a1 j( J; P' c" m
2 _9 Y: C) a }5 {6 t! g% w// Wait until simulation is finished
8 q: ^$ B$ p& Zwhile (!Finished) WScript.Sleep(2000); 7 J- F( T3 D% G$ ?% |5 n' i
& r4 c+ z+ u- ?# rsimple.CloseModel();
" {2 T( x+ e. K8 T8 Z5 s" zsimple.Quit();
# { Q$ S0 B# [$ M9 k% }WScript.Quit();
$ b# p, A& f; O( r# H4 V : L* y. F; U$ X/ M
4 @4 G6 | _$ c0 B" f$ S0 g
function RemoteControl_SimulationFinished() 6 R a3 H+ ~. C
{
8 r1 @/ b7 O, K# c2 D# f WScript.Echo("Simulation Finished!"); |