Example of a JScript
- V& m# h1 J1 a3 avar vbOKCancel = 1; 3 s9 M/ i |0 H
var vbCancel = 2; 0 S. t, u# H0 C3 S- e6 s& ^* l. p# x
var vbInformation = 64;
0 Z9 N1 O2 |; Z Q; {# nvar Finished=false;
! h4 r& j. w2 H! @. `" q
/ V* K0 H2 d! ^/ M8 x4 O$ \var WSHShell = new ActiveXObject("WScript.Shell"); & S% i: z- ?8 B2 P( b7 A
9 Y' e0 w! V) P1 ?1 p9 M7 lvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
7 v- d9 M$ j: D9 I5 ?5 ]" T" D
/ A) ]- d6 w& _# L; x. hsimple.SetLicenseType("Runtime"); 4 `0 L0 g$ Q, F
@4 Z; e/ S8 A9 S/ N; |
try
/ e, h9 N) q* L! r4 X; Y& r2 @{
9 l1 b+ C3 S/ ?8 k1 Z6 H // Enter the path to a model file! ' t7 ^! H; Y0 ~) `/ s6 n+ s. {
simple.LoadModel("C:\\Models\\Test.spp"); 5 `* @$ ~! a. V1 F; y
}
: r$ s& [! H5 \catch (e) / I7 i; F" [ [& s
{
9 @+ z/ U) ]) b. N* G WScript.Echo("Could not load Model!"); * m7 I% ]7 N1 w: ?1 c
WScript.Quit(); 0 L1 X% G1 @: G) A0 }
}
& [0 Y2 Z# x# a! ^, T2 a
" A- y3 k, I8 otry
W+ ]! a4 K5 ^0 b{ 0 [7 X5 N! q) X
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 1 n1 [. Q( q; |( Q [1 Q3 W" [
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ( c7 h7 w) l0 R6 f
if (r == vbCancel) 4 o/ I0 }5 I0 U- g" L1 V1 w
{ . _. h- I& ^7 H1 a% q' V# }
simple.CloseModel();
1 G F7 s! n( G' k. k. _4 K WScript.Quit(); $ c6 y" Z1 V# B7 |- P, A* g. o
} 2 I& S# K5 [! k$ h) T7 F
}
- z' {2 `% n. K+ I
: Y- Z; O- p8 ]* c+ n8 x8 Xsimple.StartSimulation(".Models.Frame.EventController"); & X7 ^" E9 b6 [4 q& o/ j* h
6 }; ]: }" [4 L' u$ l/ Q) S* J7 G8 p5 Wif (simple.IsSimulationRunning()) 2 K+ ]/ ~ w Y& p0 {/ ]
WScript.Echo("Simulation is running!");
6 G3 G% d, k( Z: X' K5 s % k: L6 Q( g7 F
// Wait until simulation is finished
C) I7 K. E% k& w+ ?3 Gwhile (!Finished) WScript.Sleep(2000);
4 o, I6 S3 V: F8 C+ ^( _
3 ~, D4 C2 _: t5 H: }. ssimple.CloseModel(); " }* s; Q$ t6 i4 m/ m
simple.Quit(); . C+ H7 `9 a1 A9 b$ H9 ]
WScript.Quit();
* u- h) v4 b3 g5 B$ j5 f7 A6 W
* e. G8 l* e8 c* q# v6 E7 |
$ [2 K: T7 y' o+ @4 M- Rfunction RemoteControl_SimulationFinished() ' A7 n. G# ? F$ K
{ ; C( K7 |2 r- C- D& l
WScript.Echo("Simulation Finished!"); |