Example of a JScript * O6 \% H# i m' u' k9 ]& m9 o# G0 w4 v
var vbOKCancel = 1;
$ `) u8 `7 p/ T* u8 V) g1 o+ Uvar vbCancel = 2; & ^6 {% G. @. R. u7 d
var vbInformation = 64;
: C% [ I- M o4 Y* G; r! Hvar Finished=false;
' d7 L1 l' @! Q+ P" L; Z 4 h5 l6 M' I$ R
var WSHShell = new ActiveXObject("WScript.Shell"); 2 ~+ H% o7 y6 p! E) W
" t9 }, z0 ~$ y$ G, i# m' A
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 9 k s6 p8 e/ H+ M7 {6 A! W
9 z8 K" H. V- c" isimple.SetLicenseType("Runtime"); 3 x1 g2 V. G; A: b$ A- ` k0 W
' B/ N# P0 @, Z
try
, s4 G! l) `: v& v5 {# w- ?. ~' Y{
* x2 t( k7 j% K4 ?9 N6 J1 @: x // Enter the path to a model file!
( v }0 o3 l' H* | simple.LoadModel("C:\\Models\\Test.spp"); 7 d" {0 w3 W' j% P0 q
} * p5 j( i$ J+ B" _
catch (e) 7 C! m& x3 q8 V) W# j/ m+ c
{ " Y6 L$ `; S- T/ X0 F4 a' T" V
WScript.Echo("Could not load Model!"); 5 I% k6 z8 s7 D) `
WScript.Quit();
# K8 [+ C+ p2 l! [6 m} 4 _8 m$ [# m$ L5 W
9 D' [1 e/ f* j8 Wtry 0 Q5 q9 ]8 n0 B$ _9 J
{ 5 h6 _% u# T9 U* [
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
# W6 Y. `5 _, H5 m r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
( D3 Z6 M, A8 n& \& S, y* z3 h% Y+ v if (r == vbCancel)
* K( c. |/ d2 B: x6 {$ P" K {
9 v4 v% l* S [9 A" T9 X simple.CloseModel();
% g5 O8 d" C1 I* r( v WScript.Quit();
( h% c, F: Q2 ` }
/ e# k- b; {3 M% j: y- e}
6 ^+ S! d$ G4 M0 G
( ]. K" q( B/ v; Dsimple.StartSimulation(".Models.Frame.EventController");
" [/ Z) Q2 t6 H0 Y% {4 E8 m! s
- }& H1 \0 }/ `+ _% Z0 M" U3 eif (simple.IsSimulationRunning()) 4 N. C- [1 e- w! p. e
WScript.Echo("Simulation is running!"); 6 M2 P4 Z$ v) X
9 t. A% i" \$ J( A% x( R6 P
// Wait until simulation is finished
" v1 ~1 I4 |. \! e' awhile (!Finished) WScript.Sleep(2000); 6 i1 R5 U' U0 t' M. i. } I; w" \
+ H4 U9 L0 a8 D+ G4 w* f
simple.CloseModel();
S! B- l# V3 z1 E4 nsimple.Quit();
4 w' F0 Y' o7 U6 `WScript.Quit();
* v1 d+ O1 K; j1 \4 ` 0 Y0 z4 b6 S3 U9 V" X: o
1 o+ U( w4 h, C; m- G9 vfunction RemoteControl_SimulationFinished()
+ A# E& D0 O) p$ [. h{ 1 ^& c2 Y% j: C `
WScript.Echo("Simulation Finished!"); |