Example of a JScript
" s0 g h* o" ~% O' ~var vbOKCancel = 1; , t' w9 \% |: ^0 D( g5 D
var vbCancel = 2; . p6 x& l& O: \0 Y) O0 O: z
var vbInformation = 64;
3 n. [6 q8 ?' Bvar Finished=false;
9 [3 ?8 ~6 k. Y2 W+ |3 t/ t7 S
- G/ `: x1 B, z' k' r& K7 t) `var WSHShell = new ActiveXObject("WScript.Shell"); f( `3 C$ ^5 r1 U* {
6 I0 ^3 P6 B8 m8 Q: U' [! h8 Jvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 2 I/ `3 _& D, x+ ~
: p" k+ G! B Vsimple.SetLicenseType("Runtime");
) a# t: }* Q, n: [6 Z - c. O( l2 x+ D6 Y5 b' l$ }
try
5 R5 q5 h7 ?: I{ + W/ e* j* U) A' o7 E
// Enter the path to a model file!
6 W6 r6 n; H) n1 K+ O7 c" K" ~/ z simple.LoadModel("C:\\Models\\Test.spp"); ! s4 Y! l' @5 [2 U/ t: m
}
$ U1 O# m; X. |: @catch (e) ; n* D) S5 Z. a6 w$ w: S4 Y
{
2 h. u P( d( f8 t" ^1 s WScript.Echo("Could not load Model!"); 5 i; o/ F8 u* W7 ^5 i& Z) `- H7 V
WScript.Quit(); + H1 a# k" u* P# Q1 p
} * f5 m r5 k# v2 ^
8 z* v& j; O3 B' h+ n4 C+ T
try
1 J7 L* X, s$ d1 W7 L6 Z{ 9 u. J; \3 H* [( J6 Z' S3 }
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { . e, \& r; k4 ~/ u s r1 D
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ! z: f, N' T7 F+ ]% T. l
if (r == vbCancel) . ~% @& R8 M! _3 h
{
$ J1 H/ h# S& h% k ?5 v) h simple.CloseModel(); 2 Y, f% m7 J; Z5 R: D
WScript.Quit();
2 P+ t5 {1 N0 o( M }
0 r$ t# x, e* e' s% G& ^} , j1 H; f7 Q6 z5 U9 R
1 w3 L: R' J8 |8 F& N4 m9 q4 ~simple.StartSimulation(".Models.Frame.EventController"); 4 Y: J8 @8 Y. R2 J D
7 ^1 Y1 S3 g8 }7 }: Dif (simple.IsSimulationRunning())
- Y7 j x4 g4 Y6 Z WScript.Echo("Simulation is running!"); ) z h" I4 D9 a
9 S( k! Z; K0 p
// Wait until simulation is finished ! t/ Q: w: x$ W+ b+ w, m
while (!Finished) WScript.Sleep(2000); & ^ }1 N% x2 ^. Q1 R9 a
5 ~: N3 C( L' p( l
simple.CloseModel();
j9 C6 S, P8 h |1 dsimple.Quit();
8 x7 ^& `! B9 b, K* n& A1 {* D( EWScript.Quit(); & L4 x/ ?- d$ i- j5 c
+ m" R- L1 D" T1 ]( y3 m9 p
% w- s' o. ~; N& |+ B" R/ ?
function RemoteControl_SimulationFinished()
6 ]$ B3 C4 G. O6 p9 C& z3 b, N$ f7 {{ $ Z# p ~( e" E; }
WScript.Echo("Simulation Finished!"); |