Example of a JScript * _) v( @4 ~) a( T1 c( \
var vbOKCancel = 1;
0 \% n6 Z% e; i+ Wvar vbCancel = 2; & ]" |. b- P( |2 D
var vbInformation = 64;
7 o( h& I0 B% d+ ]2 ^; Bvar Finished=false;
# O. P! x& K& ~' V# Q - p0 y! W* v' Z" W
var WSHShell = new ActiveXObject("WScript.Shell"); ! o6 N8 T: I' u& m
$ Z r1 }& P( U$ Z9 ^3 y8 a" @+ q
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
) c& h+ V) |! k W' o, M ( q1 z# l' z A
simple.SetLicenseType("Runtime"); : J2 X, y2 c, t& z
* r; R! N. L- V
try
9 o' b- ~$ t- ^0 I! ?: D{
* n. x: d0 L- Q# T // Enter the path to a model file!
; n/ N; f2 t* F. u simple.LoadModel("C:\\Models\\Test.spp"); 3 n- j; P% s) A1 ^$ C0 e$ d- k. m
} ! L3 y/ T% E ?! E
catch (e)
, x+ M- J! x- [1 S{
+ s8 L8 Q a' g7 ^" [$ T* d* a u WScript.Echo("Could not load Model!");
; @2 I0 G/ b) }2 A- U6 r3 C WScript.Quit(); 5 A ~ ?% D' ?, W/ r. t
} : H% [# W: h2 I
. g5 t; Q- [' }; Y/ x1 R, @try
' A' C' o* @1 F2 H{
4 `, i& t) h% n; [/ L( C simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ s7 W' W* X& M4 d/ i7 [5 y r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
- \1 O. G. I# X; ]1 z" s2 s if (r == vbCancel) ! @, z+ B e& `8 E
{ " \! j' i! B f! e; V) _
simple.CloseModel(); / D( R a6 k9 l2 H) w4 C. L
WScript.Quit(); % n8 c. H Z- {5 o* r3 M; d/ }
}
$ v, T- X/ d) Z5 w: l( e& U! t) r}
% r) h; F8 T; p 5 q' V* G [7 x! k: p, J/ @
simple.StartSimulation(".Models.Frame.EventController"); ( Y Y! E' O2 S- m" }6 Z! ^* {
& r) N9 s2 w! j- Y5 ?$ Yif (simple.IsSimulationRunning()) " a X. L( T/ O
WScript.Echo("Simulation is running!");
, w3 L. i E7 \% b
7 R( U% W+ f& Y# o$ j Q2 b// Wait until simulation is finished
" l" V1 b# l. g: M- U, Hwhile (!Finished) WScript.Sleep(2000);
# A7 ?% T- p& H* i8 I$ ?6 f6 K ! a) ^( W$ z$ e
simple.CloseModel(); # |$ U! V( Q6 W( q
simple.Quit();
& {- T. @0 l/ gWScript.Quit();
4 z" D6 {# [; _5 r+ F% P% N6 K+ L
; \" k0 l3 Q% s* ~9 _9 ^9 j+ D
( }7 i9 C3 \6 w. e/ Nfunction RemoteControl_SimulationFinished()
9 M: K1 Z/ a$ Q7 |{
7 s5 S+ `, N/ U' `# g7 g WScript.Echo("Simulation Finished!"); |