Example of a JScript
( T3 ]: o9 T$ ^# |& B( h+ t, V0 tvar vbOKCancel = 1;
) Y9 W1 m! L! e q! m+ E" X/ \4 z* Bvar vbCancel = 2;
| w1 o6 T: z! w$ S, Dvar vbInformation = 64;
# Q+ W2 w) u# k( N4 pvar Finished=false;
* K5 ^4 o- _5 f% r- U* `$ E: R
" f3 j7 g7 B4 [; G: {) `: x' hvar WSHShell = new ActiveXObject("WScript.Shell");
8 k% c* k& D% N
7 T9 b- c( z/ }1 N- s0 G' d4 dvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
$ g% m) @$ e) G" }
4 p( ^( y* |8 S7 Gsimple.SetLicenseType("Runtime"); 4 K+ D. Z0 M) k1 k+ ]( R9 `% [0 Q( W. g
1 b5 W {2 Y% Ltry
" j+ L4 [8 Y. c' o4 t0 F{ 1 G& r, F' B4 [7 E
// Enter the path to a model file!
$ J7 Z1 W3 x( I8 E simple.LoadModel("C:\\Models\\Test.spp");
8 Y. |8 M6 e2 w: }: L) l' |2 @! R" R}
& O, r$ w: P* V$ Rcatch (e)
* M! v7 X3 L- M: I; s) @0 A{ + r4 D( G& ?6 m, Z0 S1 K! Y
WScript.Echo("Could not load Model!");
, \: K" i- V, u0 J/ Y7 y WScript.Quit();
: r& t% Z0 O7 a7 W% l} : c4 O9 C4 S+ i3 t2 h9 X% G
6 m% m. N* N2 s# @, ntry
) P _- s# Z. J2 d* v{ 2 z4 w% N8 g$ r3 T* h C( J9 E1 z
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
$ V8 y% i! a7 |/ e2 e r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); % S; u, G( u6 Z' d
if (r == vbCancel)
. w4 p' c" x5 O O: U$ w {
9 n- j' v) _, W simple.CloseModel(); $ s2 ] N3 Z7 s& ^. y6 m
WScript.Quit(); 0 V+ e% u/ ]. [) Y" s
} * s/ q0 l1 _! s4 `1 c$ s
} $ j# J U j0 S+ C+ }. B Q# z2 [
, V+ w, t, N) k: w* \3 U
simple.StartSimulation(".Models.Frame.EventController");
4 X5 ?3 |( `" A. [6 Y, E3 t
9 B. l/ \. }5 L; d0 Jif (simple.IsSimulationRunning())
% N. O+ s$ G1 m! }- M9 y2 r$ X2 i WScript.Echo("Simulation is running!"); / G' U. W8 U- V. J1 a6 `' I, k
& b4 ?8 r8 R, E4 j// Wait until simulation is finished
" k: \/ |. t$ Xwhile (!Finished) WScript.Sleep(2000); ) |, j3 V$ }. H+ Q4 v$ k: Z% Z2 R
0 n5 D4 K" G) L5 o
simple.CloseModel();
, ?2 T' N' @+ D) z" r; ~simple.Quit();
1 N0 n; d$ L0 g7 b K6 B4 |WScript.Quit(); 9 O2 F0 z' s) C# } d. j
; W: ` h, v. O- n; g* I2 \2 d
& H% `4 B5 r5 q" u% D5 @* n
function RemoteControl_SimulationFinished()
$ Y3 v$ V& V2 K{
9 [: E% f% e, { q2 i' E WScript.Echo("Simulation Finished!"); |