Example of a JScript 3 E$ K3 P3 i/ o/ c; X. S
var vbOKCancel = 1; % _: g. L: Z3 b; k3 I7 g
var vbCancel = 2; 6 ]7 ~; z* ^" P: C# J5 G
var vbInformation = 64;
/ k2 `& M" t! B+ W" Q' A: xvar Finished=false; 9 D w: V9 _8 R' P! H
5 a" F7 s$ p! d4 Qvar WSHShell = new ActiveXObject("WScript.Shell");
! u7 Y. @* o7 k* U 2 V1 v- F0 X: q
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
6 U0 O" f0 a+ j0 F% m. i
* C, W3 a# o& \7 _5 ^simple.SetLicenseType("Runtime");
2 w, s6 B* e9 G' Y 9 o, a+ i' k0 d: t& s* ]( }* P
try
0 v. E/ l3 t7 B) C: T{ ; s q$ u- Z: H% l' {
// Enter the path to a model file! - H( E0 v3 T/ ~- O* q3 r* Z6 K
simple.LoadModel("C:\\Models\\Test.spp");
# e% \; s0 F7 g- z, U0 \" |9 W}
6 S6 a$ I: t, Ncatch (e)
% [' ^* K, g7 _) o% E{
+ E/ q! u' r5 G2 {: _" X) {4 c WScript.Echo("Could not load Model!"); , t" ^+ }+ _0 v8 s+ t" j
WScript.Quit(); 7 F; u; K& W7 W4 d# m! H
} . a: w0 X$ Z. o
( H, j1 p: f! S }$ Q# mtry # x/ L( [0 {$ [) L6 ~
{ + D7 _: s& N! r( \6 L% N0 C6 y. c
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { . G. D$ y9 O$ L
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
$ m! X/ r" y' O! O6 `# j: P& [+ I: h$ s# o if (r == vbCancel)
5 O3 v R, @3 Z5 _2 Z3 Q {
, i+ ?( ?& f) @/ S( U simple.CloseModel(); / u9 Z+ ~- D( p0 K
WScript.Quit();
3 k( @9 Z; F* q! Z }
+ P# v9 u0 ^* R6 d) E8 H# l} + I4 H3 i: h$ S+ S' \, \! A4 S4 O1 B
0 J" I3 i s( u& B4 L; y9 Y. Hsimple.StartSimulation(".Models.Frame.EventController"); ' X$ F) j3 J% O
0 x W8 H! Z7 L) @
if (simple.IsSimulationRunning()) ( Z0 I+ `' S y+ j9 x" k- {
WScript.Echo("Simulation is running!"); ) ?% N* N% U4 p5 W
( v) k u3 ]4 w$ k; _7 `. {// Wait until simulation is finished ' T; s5 ]! K% b- r/ g9 z
while (!Finished) WScript.Sleep(2000); 5 e# q; ~1 n6 k$ `4 w' t
& J/ Y/ W# t4 H5 Bsimple.CloseModel(); * S, \ h" L7 P* h* }0 Z
simple.Quit(); 3 w+ _9 e6 N+ X7 B; }1 B( A X5 A& T% r
WScript.Quit();
& T9 H' d5 ^ K
3 H$ }4 G) U( p& N( g3 K
& [4 }) {' Q5 U2 F; Mfunction RemoteControl_SimulationFinished()
2 V; U$ W* I: `' ?{
, f' {3 e/ ?+ x: V5 K WScript.Echo("Simulation Finished!"); |