Example of a JScript 7 y* u1 d+ O. s: F' x
var vbOKCancel = 1; 5 V* _/ J ?3 `9 V! @5 Z
var vbCancel = 2; - f) ~9 j) Y" z, {2 o6 r
var vbInformation = 64;
" [- U8 ^1 l+ U/ d6 x/ Xvar Finished=false;
8 a1 i1 j7 V+ E0 ] / G8 p/ v- x0 a6 T6 }$ D5 Z
var WSHShell = new ActiveXObject("WScript.Shell"); - K) i8 ^) F5 z
, d" V S. U) Z5 @; f
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); : m E5 Z, m0 \
+ A. z Y0 w# H+ s' y* |' r, qsimple.SetLicenseType("Runtime");
9 I! k: S& y* i% Y
$ X6 f+ e" y# ^0 {0 L Vtry
; f6 j. N% L7 I0 m{
( A* N* v9 r" r // Enter the path to a model file! 0 d% n9 |+ K" A8 s) U, X8 K9 Z
simple.LoadModel("C:\\Models\\Test.spp"); 7 x8 u ?; @5 X/ D/ O4 U
} ! S" O+ l9 C3 {3 I$ ]3 ~
catch (e) ! `& E# N: i( Z# m
{
' U1 d4 X2 M5 e WScript.Echo("Could not load Model!"); # B' d8 x5 [" Q6 f$ X
WScript.Quit(); ! c+ X R; `7 T. _, R/ c
} ; d9 r/ q- t& Z0 X A& ?0 C
d; b6 M' N- e4 j7 y5 j; ktry
6 m& H d! \3 z* V8 x R8 _9 } h9 M{ # n* F) t" g5 M1 c& _
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ' ]- L- ^+ q7 n9 I; ~# b0 \ {: i2 k
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); q/ Z, F. e2 j# \/ u; N2 H
if (r == vbCancel) ' f; I/ V6 n t H9 `5 {
{ % u. H ?, ~4 \6 j
simple.CloseModel(); 2 Z. k( J" m8 y
WScript.Quit();
, T9 A; o% o' A& _ }
7 `* m) r* z/ z3 d}
5 S- [* Y; t9 V j3 I
/ d& o7 p+ T* t; _! ~simple.StartSimulation(".Models.Frame.EventController"); , d; Q, J& E& k% O p4 A; I# V
9 W( `' g& j( \ t+ a
if (simple.IsSimulationRunning())
( V y& z0 ~" T$ n3 ] WScript.Echo("Simulation is running!"); - d5 z% q A9 d/ I$ P
9 U5 q/ z- u( i( r. k% T// Wait until simulation is finished
5 V1 q, X& M6 l A: v2 ?9 swhile (!Finished) WScript.Sleep(2000); ' J2 q( m1 P9 y- l2 `7 l
; K+ x- ` ?; H
simple.CloseModel();
; {9 p! b5 Y$ @simple.Quit(); ( I7 L5 A( V$ b2 ^8 F: n S% x0 K
WScript.Quit();
9 P: g) [. r7 V4 c6 t ; B0 _2 v( {9 D- r$ X9 d
- X+ c6 {( ?8 X! R4 {; b
function RemoteControl_SimulationFinished()
# H( t; s& X0 b3 S3 l0 r+ Y: Z{ $ P' O8 B7 q3 ~+ V6 m
WScript.Echo("Simulation Finished!"); |