Example of a JScript
4 g W) P3 Q1 Uvar vbOKCancel = 1; % c( c) w; J! l% N. N' V0 c
var vbCancel = 2;
+ m) O& M) f- \! K( n" t ovar vbInformation = 64; 3 m# Z& m7 p! t" J2 H; r
var Finished=false; / u3 R1 y1 c# O* C' U1 Q
9 ]! m% O# M4 _; n: `( T* \3 p% d _var WSHShell = new ActiveXObject("WScript.Shell");
4 \ k+ Q' r* |9 Q, F 4 @3 G- v# h& v8 o
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
6 U7 i9 x2 z" r3 ~' \2 G" X+ Q # }/ n$ N" N, h3 _+ b3 p2 @
simple.SetLicenseType("Runtime");
; x$ [* m0 ~+ ]4 L+ C. \ . b6 j; c* B- Q
try
# W. h' m# ?; t) R6 B# v{ / Q& N1 l/ e6 q' |( \/ Y
// Enter the path to a model file! % i+ c; v$ W* I) J
simple.LoadModel("C:\\Models\\Test.spp"); 2 y" q: }; V$ E" _3 W6 a2 U" Q
}
+ ^" c: Q' Y0 M4 T) dcatch (e)
& @) H+ Z7 K. i. m) K0 A& P! b{
1 q: B2 t$ ?+ V( H WScript.Echo("Could not load Model!"); " K7 S$ M8 g4 E
WScript.Quit();
& `1 R( {- I7 i1 s8 S* V}
, {. q2 E: p1 Y6 n2 b+ ~6 k ( ~- D$ x6 ~3 I3 f0 \* d
try
! }6 e/ w* M2 ~3 O) e0 m( z5 B{ ! h4 h' L! s" L/ r* g; f0 ?
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ; f/ z0 z# o4 |% d3 ~
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
( }5 D* T# `( s, h( Q$ B if (r == vbCancel)
2 |7 y3 H+ W( e. L8 L* ]8 Y+ ]! Q { 3 {" [- O9 W* @1 U
simple.CloseModel(); ; G& p8 Z e* J. }1 l- [1 n+ b
WScript.Quit(); ! M; h1 o" I+ q* C2 G
} - O& F6 b9 l* L1 o3 L
} 1 P% f9 O5 a% y7 g( y
1 H2 ?# p# Z4 |* Q7 W
simple.StartSimulation(".Models.Frame.EventController"); $ F' ?7 {, }. v, W( v$ F9 t+ V
/ E' y1 }, X1 K+ `# y/ t
if (simple.IsSimulationRunning())
. K) T, t) X) Z: O" M" q WScript.Echo("Simulation is running!"); ! l: M) N7 j# O
x. Z/ |6 b+ \( V: r// Wait until simulation is finished
8 o# w$ A, ?4 D) uwhile (!Finished) WScript.Sleep(2000); , b, A4 O7 f. s
4 l& s9 k6 {% I6 g3 D
simple.CloseModel(); 0 H8 i" D4 |& V& |" s2 `" H& {0 \% @
simple.Quit();
$ S+ l% Z) G. K1 _; EWScript.Quit(); 3 s d) P$ N3 s# P' K' V
) x0 `4 i( v( e* I$ W/ P: ?# Q9 N
9 i. o" J, g; |function RemoteControl_SimulationFinished() 7 _; O4 N3 q+ ?$ c* Y0 s! V
{ 3 } C! g o5 D7 j$ X' v+ D. W
WScript.Echo("Simulation Finished!"); |