Example of a JScript 3 w2 [0 R: q; ^- V) Q, B
var vbOKCancel = 1;
. c3 d2 k$ V( o8 m9 q) Pvar vbCancel = 2;
6 P) R- u$ m6 p$ D( Yvar vbInformation = 64;
$ T: ]1 `& d% @( bvar Finished=false;
4 `3 m: V$ b3 L0 a/ t8 T
8 Z/ Y$ p# ~/ f3 \ Vvar WSHShell = new ActiveXObject("WScript.Shell"); : X- k0 ?6 m2 `1 C' j$ B0 D6 V
3 e% I' U6 A% u3 V6 v
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; b/ k' K" N$ A1 T9 s
% b% F; b; Z7 \simple.SetLicenseType("Runtime");
) q$ `. R! _' ~$ i
' g* `2 T h3 Q+ S0 { o6 M) i) Y. Ctry
1 S2 P9 ?! V9 T1 O" W$ Q7 C{
1 b/ L& ?/ u4 r1 c* y7 j! u // Enter the path to a model file! , U. s9 F" P1 j- P8 w
simple.LoadModel("C:\\Models\\Test.spp"); 6 k, r- ?2 L, s1 E
} . R' n& i# C' D% r
catch (e) $ H) m& Q5 [) P s
{
2 P( {/ T6 r c; G! T/ b WScript.Echo("Could not load Model!"); / c1 z7 J2 _/ d2 X$ l; N, u! g) o
WScript.Quit(); : ]2 G. p# p3 k/ W5 U: N" _
}
. c& L; r" X6 [3 G1 d+ H) C
3 ^# r2 c8 w& \, g2 htry t, e0 j$ _8 @/ H6 q% ]; ]' _
{
2 p+ J/ n& C [) w6 r simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ) h9 x# ~! b! ^
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); . I; {) X) R* E& |% B4 m
if (r == vbCancel)
I7 j+ W R2 {/ O! L( N, Z! m {
1 R( q% ?" E V. L! n8 b ` simple.CloseModel();
( d& w9 n% @4 g WScript.Quit(); 0 s3 Z! i+ ?1 b5 V" l
}
% n3 U$ {+ @# P: {, _$ U} 1 k: C# C, n4 d. V. b4 `! d0 v' \5 O
# ^5 I& n6 b c j( h" Q0 Csimple.StartSimulation(".Models.Frame.EventController");
5 c% j1 _7 U2 y0 k# q5 g . n& q1 W8 A; J$ ~% |. `' t
if (simple.IsSimulationRunning()) 9 c! }, C4 b& B6 c' m
WScript.Echo("Simulation is running!");
- x# i# v9 M& B2 g3 w& s1 {: M, K
: d. q9 k$ D0 G* D& [3 o7 v! e: }// Wait until simulation is finished
. ^# W$ h0 P9 {- {+ x5 T8 qwhile (!Finished) WScript.Sleep(2000); 8 }- U* o. V+ b' R
8 }# e, A2 |) c
simple.CloseModel(); 0 @, r6 R7 l c: t3 z7 b
simple.Quit(); 8 k% E( {0 q5 m+ T" z" }7 a w$ \
WScript.Quit();
5 l: L( H4 R0 z3 Q; i
' l4 z; B. ]: ^& N6 R- U% \
- W( z" d" W( R# U, ufunction RemoteControl_SimulationFinished() ( H# b/ K( G4 ^. |
{
# ?8 [& E0 d; b# {, h WScript.Echo("Simulation Finished!"); |