Example of a JScript
* P' V+ ~: K: q! A; o" ]var vbOKCancel = 1; 3 Z ~: P# D1 z, D5 G- z$ _
var vbCancel = 2; ) Z1 @8 _$ b6 D# R
var vbInformation = 64; ; `+ z1 |8 V3 m$ r+ J" x
var Finished=false; / a2 x, x y$ ` T3 E* [! C+ u
. J6 ]7 D2 p+ ]5 G3 }, J+ p
var WSHShell = new ActiveXObject("WScript.Shell"); 0 B0 s, B8 |* b+ e# }
. H& U' F, d' G: L4 @2 y& g% lvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); - B. `* D: p9 \. R( V6 e
! Y8 @8 ]9 ~% {: e' C+ fsimple.SetLicenseType("Runtime"); ! ~3 ^9 ^3 B+ A" a! O" Q
! W2 {' g! |2 C; d# Y' H% htry 2 |- [4 X; a3 V( e- w* o3 s/ o
{
: Y; G2 w( Q- K6 o8 t // Enter the path to a model file!
R3 K$ _3 x: V simple.LoadModel("C:\\Models\\Test.spp");
) S! S7 M, |6 ^0 B" [! ~ U} & B: W4 ^0 S) g4 m) U/ l: x- e3 q
catch (e) ) |( R, o. \3 d8 ~& a4 R* k
{ : W" h+ p" l. n
WScript.Echo("Could not load Model!"); % a, j0 h- c2 z8 q' \8 E& ^ u
WScript.Quit(); ; f; t$ j+ u6 m( w: b4 f: e) F
}
$ b8 [( [$ @% ]: f% O 7 N h$ v, _" A& w
try ; y; ?& S$ }9 s. i7 `( ]$ {6 W4 ~
{ " f# F6 a* s/ y2 ?/ x
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
/ Z( M |. w+ `( _ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); $ z0 M/ V- s) D, O
if (r == vbCancel) # S. {7 X. E/ F2 |+ v
{
% U0 y" l6 B" j' l7 d1 B simple.CloseModel();
5 B+ u) e; Z0 c6 x! i# Q, m7 b5 |5 H WScript.Quit();
# g( R' M, ~" R: D. l- {5 K } 8 t' f3 l( q( m5 J
} 6 {, @5 k1 W4 c( x1 e
7 G$ ~+ a% L% T" K" Usimple.StartSimulation(".Models.Frame.EventController"); ' v( D: R3 t2 i7 X* v6 X
* M1 |. L/ V! A. c1 P/ l) J5 S9 R7 F
if (simple.IsSimulationRunning()) $ N* J6 z/ H- l; w3 A1 g0 @0 f4 u
WScript.Echo("Simulation is running!"); , {; H) N( @/ x) c5 Y
, c# H( S. K# I4 _9 G! L
// Wait until simulation is finished - X4 t# K/ j. m, m
while (!Finished) WScript.Sleep(2000); 0 c, k3 J9 {$ `% ^
- B! @, d" P( g- ~* @- {0 ssimple.CloseModel();
! T0 g0 K. ]" J5 O c) usimple.Quit();
9 f. J! E/ e9 j- @8 uWScript.Quit();
* u! j5 x( w) t9 _4 A+ L
; z$ w3 b' d) S i
) i- Q, D) u7 |function RemoteControl_SimulationFinished() / l) ]* l$ e! U2 h- ?
{ ) j) |! }: ]7 r: K$ j. z" _
WScript.Echo("Simulation Finished!"); |