Example of a JScript - _9 [* j. N5 o6 Y" H! P- V
var vbOKCancel = 1;
, d/ B7 b1 D" X- Avar vbCancel = 2;
# `5 [0 a# \+ z3 q7 {( N% }var vbInformation = 64;
8 `' v8 o1 Z- [- vvar Finished=false;
3 z4 X, m6 @4 f- P1 S# x. c
) t8 [) h3 e( b8 E" E# \: o! ^var WSHShell = new ActiveXObject("WScript.Shell");
' v+ n" t5 a. H T( A0 S- W
. y$ w. l7 s3 Jvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); , R2 j; \- N# T3 i; ?
: D) B. ^' ^* M% {" Y- {simple.SetLicenseType("Runtime"); 8 l! i3 j( ^3 M! W9 B$ m( N
+ Q7 k2 S' Q& t8 s+ P
try 4 ?. Q% M, W/ O" B2 [* r, [
{
' g3 a* t" U: l0 K // Enter the path to a model file!
2 c% |: v8 U, s simple.LoadModel("C:\\Models\\Test.spp");
* V7 c1 z1 h% G; d7 }9 X} 9 C$ }. ~5 u% \
catch (e) " | d* }( N& S
{
, w7 i; V) _! c: t+ ~+ }& V' w! j WScript.Echo("Could not load Model!");
/ J% _' ~/ O8 _ WScript.Quit();
4 p3 M/ N7 E1 ?} V3 w! v3 n5 y% k0 P5 z0 t" ?
5 ?! o, k. K/ k6 o& Htry 7 [9 G1 w0 L. K+ f3 p6 t$ w. F
{
3 r2 } h' B; T7 t simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ( u0 x) t( ]( L7 X5 B; R3 l
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
* @1 |0 O8 e' C if (r == vbCancel) 1 t! J# c# Y4 J' j' \
{
6 t$ ]2 h6 h2 v- h simple.CloseModel();
/ r3 D3 C R% [8 S WScript.Quit();
9 w9 i9 V! K& X: R& Q }
) L, E& X1 X! {8 \! q, O8 e}
% a- {8 A M9 ~2 q 4 a" ^" D; v6 m4 u3 M- L
simple.StartSimulation(".Models.Frame.EventController");
5 n, \# x8 E8 v2 ?) D# r ( M- ?0 z8 b5 w* ~* N6 F
if (simple.IsSimulationRunning()) y, p( w$ g- ?1 N; b5 t7 t
WScript.Echo("Simulation is running!");
3 L6 |% d& u4 J3 t# d- L/ @! [ ; n' g/ y& `3 R1 ?& ~$ A ] ]
// Wait until simulation is finished 6 A+ |: \; c; E3 t4 G7 O, R: Y
while (!Finished) WScript.Sleep(2000); , ]) j- P# G1 D4 ~
1 \- E' M3 D2 v3 @9 X7 E3 jsimple.CloseModel();
; v) V6 P$ D' q1 s" |* i5 x: a2 Lsimple.Quit(); 4 R7 o% e$ v/ `0 |! R8 k
WScript.Quit(); ; S7 U9 q9 i7 X! W# Z. w
2 B4 x$ C: N8 Y
; S: `2 w1 u8 {1 a
function RemoteControl_SimulationFinished() ) O8 w4 b$ h. H9 b; d/ V
{ 0 S* f$ k6 ?+ {: ?/ R
WScript.Echo("Simulation Finished!"); |