Example of a JScript
4 Z9 S: ?& Y/ O, F( s" B2 nvar vbOKCancel = 1; + _2 l! @% C" p/ y
var vbCancel = 2; 9 w6 U r( h! j9 q( `
var vbInformation = 64;
2 i. Q5 G1 ]- a) c; v+ i4 S( X5 D7 G' nvar Finished=false; ' ]1 k9 `. F/ @' K7 l: e% D2 F
& M! P* n/ B% s( [" |
var WSHShell = new ActiveXObject("WScript.Shell");
5 O$ {1 S, W- R2 z . Z7 g( \! G8 P* d
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); " m m: t4 t2 m3 U: Z( v
% j3 l( I" U; Q5 @simple.SetLicenseType("Runtime"); ) k5 `! t# e) H% P0 U8 q+ I; I$ v9 ~
1 f+ J& y7 e8 c* Q9 a: m
try 5 y. u. e7 l+ j1 \* ~
{ % {+ w6 w+ e6 D, d
// Enter the path to a model file! ' I; A. k2 d; |0 C
simple.LoadModel("C:\\Models\\Test.spp");
^: ]# I8 l. j; o3 q8 L. A. P}
, T. y. H9 Q3 I) Zcatch (e) ! u/ P& e; C- o! R
{ ; ] H! ]1 I7 L
WScript.Echo("Could not load Model!");
7 Y- Q. l, K8 _" y4 D WScript.Quit(); 1 `# a, R; s: U8 F* E$ r
} ( `9 n; J R) Z0 H6 a8 ?6 Y
; a' a1 T0 |) M& l+ C4 G5 C( }try
% @1 d4 I: m1 m0 Z& y# P{
% q8 Q3 t* y# v6 ] simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
; q/ \3 F/ h# V- h1 Y r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 1 A5 e/ o' n9 y$ v$ Y# g+ s
if (r == vbCancel) # \* N# }9 C0 B
{ 7 E* k& l/ z' q: x* S
simple.CloseModel(); ( R: v1 `6 F5 n+ U7 \# j4 [* S
WScript.Quit(); 2 U- D: I- k! J9 M5 |% a7 @
}
2 J6 d, D/ x. A7 d) O! }} - p4 X5 K7 b8 F! D
2 r9 ^" A, c3 o: B# o: B% T
simple.StartSimulation(".Models.Frame.EventController"); - V& O8 {3 r0 m! O I( H
* E, O3 M0 b8 f; H) Hif (simple.IsSimulationRunning())
( R0 N3 p( t# [- D* c WScript.Echo("Simulation is running!");
" |# ]. c0 Y) `+ }
4 f- b' K' k$ w: z D// Wait until simulation is finished 0 ]* Q) L4 A) m; b, C% S
while (!Finished) WScript.Sleep(2000); 3 H0 @$ |# l2 J. d/ M ]
# c3 M1 j+ q+ W% \2 d) J
simple.CloseModel(); " Z* q: I' s8 @) s9 U5 v! U& w
simple.Quit();
* ~/ x, w7 Q" y1 v3 W( ?WScript.Quit(); ' u4 M4 c5 Q, E: K9 t- H
5 ]# n% C) j1 _& \
+ V( w) l3 Q, l- ~0 N7 H/ i; qfunction RemoteControl_SimulationFinished()
% H$ F k8 C' V! ?/ ?' z. n# j{ 0 ]6 @4 d# k/ t/ g
WScript.Echo("Simulation Finished!"); |