Example of a JScript 3 L2 p# P6 W: x9 Y8 f3 S
var vbOKCancel = 1;
! C g$ `8 M& Hvar vbCancel = 2;
- k$ U% j/ J* ^0 l) i- Xvar vbInformation = 64; 5 R5 H& T8 i: }
var Finished=false;
0 g6 j( M* s( x$ C' |9 @# [* ]8 h ( ? U7 g+ q5 j: H9 y
var WSHShell = new ActiveXObject("WScript.Shell"); % R# N6 n* b) i" l
& A3 L. o# s; g$ M! e# h
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
5 W4 j, z; M; ~3 o 0 l, H$ ~3 ?8 `) g' Q
simple.SetLicenseType("Runtime");
5 M0 @( A, z7 j8 q) d L. _3 H, m$ D' a; B q! g- m0 v
try 5 _& Z& i5 `& @" b2 Z: `7 Z. @ ]0 T, e
{ " A* q) D7 f( V& F
// Enter the path to a model file!
! w+ a: I. E+ r5 g" Z/ G simple.LoadModel("C:\\Models\\Test.spp");
3 J9 X, w0 N& D* H$ ]} $ ?# Z# [. D, c+ q) p' ?, J
catch (e) # i5 e, {/ |$ D* h1 I
{
+ G: _, Y% m# Z% p WScript.Echo("Could not load Model!"); $ t) ^" h3 j+ \4 }' J" g
WScript.Quit(); 5 z7 E) X: o! Y8 \, C- K; j- c& c1 T
}
; n. P x7 B4 S' ?/ R
Z- R& ]; O3 ] v% M% etry $ s: F4 Z. z1 |0 B. B( y3 G) B
{ - M6 v+ H* @$ V9 j
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { o& b3 K" D, Y! E
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); " U& d* D" U8 u
if (r == vbCancel) $ k" w) T0 O+ S! Q& u Y1 `1 [! n& g" F
{
6 \8 C, K& X Q. ?( e9 a simple.CloseModel(); $ i6 W4 ?6 V3 M+ a$ I3 ~% N
WScript.Quit();
1 e# ]4 n$ }, ]+ [" _& f" w }
5 G7 _ q: ]) g6 ?} " I$ ^( t9 ~2 T
! O8 ~8 D* U7 csimple.StartSimulation(".Models.Frame.EventController");
' i! |, [- P( G: ?' }& o5 | J# [
2 l' z) x, E# c. nif (simple.IsSimulationRunning())
7 D7 \4 J; a: x, h" y1 w WScript.Echo("Simulation is running!");
7 W6 q5 ^; [0 ]7 k9 K/ E * D2 N& V3 a* _8 i' m2 O) R! \
// Wait until simulation is finished ) d- K- t4 T8 ]0 l% ~9 h8 s
while (!Finished) WScript.Sleep(2000);
: A9 j1 _& A8 ~1 b2 `( R3 S' R * Z, K) n- u' x( G. G" ^2 o+ l
simple.CloseModel();
Z+ ^4 G: w. j: n# R ~simple.Quit();
9 `4 A9 v8 f% u9 tWScript.Quit();
- x: ~/ g8 V3 A3 p 1 e- x! G9 F4 ?# D( L" k8 `% J
5 f0 C' P/ G0 v Nfunction RemoteControl_SimulationFinished()
8 T# w7 u0 ~ w) L3 O{
5 [2 \, n- k4 h9 w WScript.Echo("Simulation Finished!"); |