Example of a JScript
" {- A5 ?) c$ f! R! {) J9 Hvar vbOKCancel = 1; 8 O" T) [' f% p0 V. y' k
var vbCancel = 2; 2 T% L4 e1 Y, W8 a: c. H
var vbInformation = 64;
$ {3 ^" r9 W/ T; ~+ b: \- ?var Finished=false;
8 Z- ^1 g0 e: s) V8 f
* b$ G* T( c+ A+ q m6 Z6 U8 Q- w4 O( avar WSHShell = new ActiveXObject("WScript.Shell"); - L; B0 L: v6 p8 y
6 D* B9 S( @0 u5 `" J, o% mvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 0 w+ m; w- q# J: S
: i6 w" L# C" k/ Q$ H
simple.SetLicenseType("Runtime");
+ q+ g8 M9 @7 B3 \ , h$ d7 ~# S% V) B
try
`$ S& t5 p6 l4 u) R1 |6 U$ a# c{
9 S: s1 I, [+ G- Q0 \. b; z // Enter the path to a model file! 0 o9 P# c3 Y6 ], E3 h, b/ o$ w; N
simple.LoadModel("C:\\Models\\Test.spp"); , m' a) U" `8 M+ F F: y" k1 Y
}
O! i8 l9 w) M! v wcatch (e)
8 \. A2 h1 H2 A9 `. K{ 4 j; [2 v1 l% t' m4 C
WScript.Echo("Could not load Model!"); C. K! ~' g$ |1 O+ B
WScript.Quit(); # s; @- J5 Y3 E" w0 m+ Q
}
0 ^# i3 d' v; }
& P3 E: m) {. z Z" t0 q; Xtry * u4 X1 \0 g/ m
{
1 o( C+ \, {7 ]2 o8 `& l simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { : @" x P9 R) d6 C. A# ]. w2 e2 y
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); * W, O. [+ d* }$ |! l5 w
if (r == vbCancel)
7 R5 C6 O% ?* z) R" S/ E {
7 p0 Y' H+ \9 o3 i) G# Y1 ]$ N simple.CloseModel();
% ^' E0 a% U: }, l: ?, x+ |3 @! u WScript.Quit(); 6 _& K) M: M% _$ m6 I
} + f8 R) w3 B+ R+ ^
}
# }* f; |0 j* H2 U 9 C1 n3 L: @$ G8 A. S+ V8 f
simple.StartSimulation(".Models.Frame.EventController");
0 Q/ @# }" s8 S$ |8 q# ^
! T) d+ y7 ^# ]3 J/ X7 ^0 ~if (simple.IsSimulationRunning())
- `. v8 x* @: u3 M8 V WScript.Echo("Simulation is running!");
2 ^* m$ }) P Y+ z: {$ w) A
! R# M" _/ w L& c// Wait until simulation is finished
y5 r$ A; J0 F* cwhile (!Finished) WScript.Sleep(2000); / w3 n# \$ G0 e# ~
7 E/ Z! R: _( H; m1 \ d R: d+ lsimple.CloseModel();
7 F4 _# u+ n' t# D5 isimple.Quit(); : b) h& j; w/ @: J1 W
WScript.Quit();
- E! i, M. V+ @# h1 A) x6 Z6 q# W
6 q* b& t$ |& N* i$ { ( o. n0 u9 C2 k9 X
function RemoteControl_SimulationFinished()
7 Z6 U( F* M& d& M; l& s{
9 P1 z! f R1 w2 m: Y0 }( ^( L4 m" S WScript.Echo("Simulation Finished!"); |