Example of a JScript 4 G, }9 ?( X" v& B* H! r- H
var vbOKCancel = 1; / G& l1 i5 s, x8 @2 S
var vbCancel = 2; $ A4 l1 P* m6 I( T
var vbInformation = 64;
4 ^0 c; h9 C4 b; K0 rvar Finished=false; " p8 g# b- P* ~0 S- z3 _4 Q1 M. F
& H8 F; o: h0 z/ q! N
var WSHShell = new ActiveXObject("WScript.Shell");
8 [9 {8 Z+ K0 e/ \6 D
# z' ?# b B( }- a8 }var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 4 d7 G7 ?) t7 _: O d+ Y
6 q3 Y) w2 j& \5 l& Ysimple.SetLicenseType("Runtime"); # C- A+ c& v5 `; \$ k% ]1 p
# k' j3 D7 A5 t2 K$ ~* C) Wtry
1 E# |6 ~: c2 b' X( |5 z; O8 f{
2 e6 ]$ Z( [9 i' D, V* T6 s // Enter the path to a model file!
' T5 L o- s; c, R+ V simple.LoadModel("C:\\Models\\Test.spp"); 1 @8 I' c: R8 P; }# V# m9 D
} 2 e8 t+ b# {8 \2 A
catch (e)
u) l( H1 i5 \3 s' v. E8 ?7 ]{ ( W+ r9 l" n( }+ _! a
WScript.Echo("Could not load Model!");
, j. F3 a, D; r" n8 C. C( v% M6 O WScript.Quit(); % g; l x+ f: \5 ?' [
}
" F5 T: F* n E; l6 M
: @: c3 c2 S0 x8 d$ u2 N! mtry ( q, Q+ S* c6 b) |; z* ~1 W# s: C
{ " L @/ b! R; n: u) j
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ! `7 u8 x2 l/ e$ d* O
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
& M% e" R5 d4 M/ R if (r == vbCancel) + l* j2 ? g0 _9 S8 r- o
{ {( ~6 J. @8 o0 b- Q- n* h! z
simple.CloseModel();
! x, a X, Z! x4 r# H WScript.Quit();
# g( ?+ h9 d" B/ w }
& r& u" w! t' K D& ^/ g} 9 R, p4 X6 p' Y' L
" ^0 u, t% n5 a( K" i4 esimple.StartSimulation(".Models.Frame.EventController"); - c9 D' [& F E9 M) }7 W! f+ I1 a
3 t4 V: M0 j- d
if (simple.IsSimulationRunning()) - M7 I/ S# g% e# X
WScript.Echo("Simulation is running!"); 0 T2 P9 K. W" u
/ a' g$ k. r" Q( L6 _9 @// Wait until simulation is finished
; w+ T- q+ G# x3 Z1 ` C3 Z0 jwhile (!Finished) WScript.Sleep(2000); ! E" V/ i1 T9 \ ~
% p$ i8 v$ |" V! Z2 f
simple.CloseModel(); + {' d p% k6 Y5 d) Z
simple.Quit(); 0 p. o# c9 c$ Z
WScript.Quit();
b# p I& H1 ]( U. M$ [$ M2 C( V* | 2 V/ [& V% J7 E3 b6 x
% |- e U4 z Jfunction RemoteControl_SimulationFinished()
$ j8 i% C+ Q8 R6 _3 ^& H6 z; R: W& J+ ~{
) J% p. g1 ?9 o WScript.Echo("Simulation Finished!"); |