Example of a JScript
, [; n# x/ Z( I: s1 @var vbOKCancel = 1; ' \, u+ Z! ~) Q0 [
var vbCancel = 2;
. W) U# }( A+ Q4 s1 F X1 ~7 R" [var vbInformation = 64;
* | ~0 r3 j# T! p `var Finished=false;
( a1 c; d8 S! l& m# X3 q : d7 p9 R' r: v$ c" K
var WSHShell = new ActiveXObject("WScript.Shell");
5 I$ g O3 p- s/ w) K6 @" E
& T9 H. c+ ?; `. ^var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); $ ^: v9 a5 Y) b0 L8 h
4 a" J G1 V, p0 V* T3 Q
simple.SetLicenseType("Runtime");
, N- ~5 n1 \3 _: r' [4 Q : @, j6 h! T2 g W8 {) }( K
try ! D% _" C# O3 `/ D
{ , ]& I- P+ D+ J2 E( Y' [
// Enter the path to a model file!
h/ }: l9 p5 E, C2 a: T simple.LoadModel("C:\\Models\\Test.spp");
/ d4 J" B& N( o F* J9 s) d% Q' V} 2 K( U3 ]& B+ u
catch (e)
! @7 L$ }' T. J6 V7 l( ^* b- P8 B{
1 \+ G- s# @ _! Z8 K3 ]( E/ X WScript.Echo("Could not load Model!"); 5 j* f: d- W0 ^) J6 A
WScript.Quit(); 3 R3 |, L9 J" m0 R
} % U2 s) ^! h$ p6 p" u* u( M
8 i3 s: [$ Z- _- ^& W- k8 Otry
S2 f% j* M/ _$ r' d{ 9 t* p4 h' }1 f4 _# R
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
0 F. s \/ j* t5 m' B" b; z" r r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
1 J4 N9 X! k) B4 |7 N3 b if (r == vbCancel)
: w3 ]) c* k: S7 `& r. D {
: f( r5 t7 @5 |4 @' P simple.CloseModel(); ; e1 ` x/ [. ]. c9 ~- Q9 b. l, T; g
WScript.Quit(); 0 B8 V# {) E9 `9 b6 b7 E( w( P0 d- _
}
- |# ?5 T5 c" H7 h} ; o1 F. G) t0 i! K- j2 j# l/ T
2 r2 A2 J9 D. B1 v& K
simple.StartSimulation(".Models.Frame.EventController");
' u3 G8 }+ |3 b, L; y+ ], u ! c3 G* g1 `2 @
if (simple.IsSimulationRunning())
" s* {9 a1 ^5 o- M8 c WScript.Echo("Simulation is running!");
* L9 ~9 b1 K- |; J$ j % C d z- }$ I- `! M! t4 \* t
// Wait until simulation is finished
2 g3 w$ d3 b/ D& U5 d3 t" ~while (!Finished) WScript.Sleep(2000);
3 y; R- {5 @( r, X$ p& R
6 K4 H: O% k5 T5 a3 f+ w- j" }simple.CloseModel();
( M% v9 v3 o' H) X/ _0 Q+ Bsimple.Quit();
5 C9 ]( @! l, H1 I6 Q& dWScript.Quit();
1 D# Z% m1 a$ E, H! C% Z / \5 N+ b+ |) w2 r* g) ]+ q
) u1 i- {) @0 f% W' o3 cfunction RemoteControl_SimulationFinished()
, U. ~# K& M6 {3 V% w{ 0 u' d+ G5 W3 C. `4 y1 |
WScript.Echo("Simulation Finished!"); |