Example of a JScript $ l0 z3 }8 x# c* s h
var vbOKCancel = 1;
A6 J; D2 E* o3 P4 _var vbCancel = 2; 4 m/ i9 F: l1 I& Q& p; t" S
var vbInformation = 64;
4 o' r2 K6 s6 [2 s1 t! t- I, Fvar Finished=false; 8 J( ~( x/ x, _" s! g' U& h
% s+ |( q# d+ z' u
var WSHShell = new ActiveXObject("WScript.Shell"); 1 y* y8 C, @0 F5 j9 U9 A
# i9 A7 @; m# p+ B: r
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
\+ x F, O5 _* u 5 P! F! e+ D1 c" Z3 i
simple.SetLicenseType("Runtime");
9 `4 A* b- Z: V/ B Z1 e% Q 0 ^7 F6 [& g/ S, m l/ h- b
try
) E# e. o1 O( D( c+ j. k# Z k8 \{ % ^1 Y0 l, ~" {. o
// Enter the path to a model file!
/ t9 W6 u) u8 s$ `# F4 l' a" N simple.LoadModel("C:\\Models\\Test.spp");
) ~! B: F5 d R! r" J& {} 6 ?$ ^8 E; h5 x' v- t9 }8 m7 U
catch (e) . V; h7 E' ~; K# C" b1 n1 d1 n# U) v+ X
{
, r* q8 l Z% k WScript.Echo("Could not load Model!"); 5 t y$ b# ~8 J9 N* {$ G
WScript.Quit();
7 U8 t" s2 m7 M; ]+ P2 T9 r}
/ Q! q6 j U: f+ b
! v! t( R5 _6 \. b" \try
, l) h7 Q% O: V, i: `+ w$ u2 H{ $ U# `9 [! c8 g3 z
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 3 `5 I/ @" x! W0 M# ~4 h; o* G% g
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
/ z! V" b# ]1 w' {' K if (r == vbCancel) , I8 F6 c5 W4 i- Q) ?
{ 9 p7 \, E, D% Y% T$ h/ ~: X# X
simple.CloseModel();
, U) r( v! m3 Q9 F WScript.Quit();
/ w( e" x- z2 s" V# a8 o9 x } % w; J8 ]+ l' `6 M i! j
} 7 s' n; v1 d1 j) a- w
, o7 O7 O! T# A
simple.StartSimulation(".Models.Frame.EventController"); 6 j" |. u( o6 t; R; r
1 }! `( K. @+ C' a, pif (simple.IsSimulationRunning()) & B% M) Y+ n' Q% M
WScript.Echo("Simulation is running!"); ; o- f0 |1 w2 ^+ K' h3 ~: H* U d! l3 V
6 I, U2 a, y, L1 V// Wait until simulation is finished , j ^, K6 J; G- q
while (!Finished) WScript.Sleep(2000); 5 n5 U! f( S5 I5 e, j! a
. I9 W& _: o1 V% Y( C+ k4 zsimple.CloseModel();
4 S7 {( h' k8 @; O+ O! F; Q" O' M8 Psimple.Quit(); # u5 G+ B* S8 F7 C9 N
WScript.Quit(); : v# U/ B) A; d, B: o/ T8 ?
9 P: V) |6 p9 Q2 P1 A
* _. E3 e0 l4 o* E% Yfunction RemoteControl_SimulationFinished() * \% x. W' X/ ?
{ ( H5 T" |. Q* s3 X3 w) {9 g1 O
WScript.Echo("Simulation Finished!"); |