Example of a JScript
+ Y1 y+ u1 g7 I% j3 G4 D+ d3 c* Fvar vbOKCancel = 1; $ Y" v7 V+ T) z! m( c- e, v
var vbCancel = 2; / F+ V* v8 N; M0 z3 h _. w
var vbInformation = 64; W$ Z0 J8 e' g m* V1 S
var Finished=false;
* G; A8 @, c) J0 R0 P, ~
# U) M- ]1 ~% B1 _! y6 U. @. _var WSHShell = new ActiveXObject("WScript.Shell"); 2 [$ l6 N3 L5 G! v4 r
( V9 Y" D5 |7 `) \& v3 Hvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); " w" G" z* h7 p) V0 r5 g. g
H3 X' Y0 T; _. U1 jsimple.SetLicenseType("Runtime"); 9 ]! G% V6 J" ]" }; n0 Q
! h4 M* o2 H) Y8 f0 z7 |try
+ o5 y! ?. A# K d1 e" D! @{
: t+ E2 R5 U2 D6 ]2 T // Enter the path to a model file! , ^4 X5 K% A, s% T
simple.LoadModel("C:\\Models\\Test.spp");
9 i- _: @- h: z4 _} & V) D# M: k$ o$ x
catch (e)
% o) N6 h) _( |2 H{
& s- ~7 O* A+ g- l- D9 w WScript.Echo("Could not load Model!");
9 G$ W/ b! K# O- b WScript.Quit(); 0 K9 x1 Y5 q7 K: X9 N8 H
}
. ?/ V; l5 h2 G- z8 Y7 g " P2 C% R0 Q3 X& s4 k$ C/ _4 v; {- R
try
" M6 w7 w ^5 i4 p+ W6 G% r! w- L" B{
- Z- Z. [/ {/ o simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { " ?6 V; Y8 m9 Y8 t$ P
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ' J8 d2 g& x- K( \
if (r == vbCancel)
6 q( t* J1 }" j* Z {
" S) Q5 l. ?% J3 I2 E) ~% b( J simple.CloseModel(); / ^1 r5 `% H( _ F, h4 m3 u% }$ T
WScript.Quit();
5 |& n+ ~& N6 A } * g. q4 u; g6 S+ f
} ; v" X/ r) M$ b
' n$ d; D6 L# ^
simple.StartSimulation(".Models.Frame.EventController");
$ h$ `0 l$ z6 L* R
$ h; \/ ~8 \ n9 n3 g: y; Hif (simple.IsSimulationRunning()) M( n' |* N% h# F
WScript.Echo("Simulation is running!");
* m( m% f) q M" X+ x8 q1 P ( r3 F: e+ ]* l5 Q
// Wait until simulation is finished
' S" S8 o5 B3 }0 g' Uwhile (!Finished) WScript.Sleep(2000);
& h0 {- E: I" J5 \
f% ]5 e; \: ^2 Wsimple.CloseModel(); 2 F6 D- b7 i4 ~% k* k# p$ U! r% ~ d
simple.Quit(); , q! E2 R% c; K5 F$ k( G. z) q: `
WScript.Quit();
8 Q: a$ |, O) ~4 p
z2 N1 o$ d/ L; u 1 w0 ~/ D% j6 U$ A ^ S+ K# }8 b( B$ J
function RemoteControl_SimulationFinished()
" A2 a5 ^& i1 h7 g: ~) ]1 ]{ : e& ]; R7 O3 v3 z, B
WScript.Echo("Simulation Finished!"); |