Example of a JScript
6 A* }4 Q0 g4 c6 p) _var vbOKCancel = 1; + F) v8 d( g: B! g: s
var vbCancel = 2;
/ a, x# c6 F$ dvar vbInformation = 64; 9 l) c3 j. G% S% }, V3 _
var Finished=false;
8 k3 b% u* j, m1 C" H; U 7 \" A7 _1 E0 _* p& A* R
var WSHShell = new ActiveXObject("WScript.Shell"); $ F# d# S# t1 y& J! k
3 @; `, g, i V+ \ w) s3 t
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); " U/ p. H- t1 V
! W" L# W4 `; h- R4 v
simple.SetLicenseType("Runtime"); 5 [! ]1 {% ]* D$ _* t
! ?/ X4 I1 K L! ~- M6 S3 i# M
try
/ o! n& v, h4 Q" L5 Y, W{
8 }2 Q6 p! b, b! ~ // Enter the path to a model file! * Q% U$ q* R' a% i/ u+ w1 o
simple.LoadModel("C:\\Models\\Test.spp");
7 V/ D2 U9 s8 P/ w}
/ I$ L5 p' M) Rcatch (e)
) M3 ^2 u# P7 @5 G9 h. r; A' E{ 9 \5 c5 T9 v" z4 \8 Q) F
WScript.Echo("Could not load Model!"); + }' P1 J% A1 \. L
WScript.Quit(); 5 V a. i- v7 N
}
# ?8 F8 M5 t# U. @# q& H/ F$ m ( {" K% p$ @/ s9 [; W
try
2 p" A( X$ z- S1 E, Z{
8 y8 f- K! u5 m8 V) j# x( V simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ [/ w$ f6 j. J) d+ n% [+ } r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & X" w0 d5 P8 ]9 |- n2 T! @
if (r == vbCancel) + i, [* {7 z0 ~. O2 q+ r. W$ C
{
" S; o$ r! ]6 v9 f5 s simple.CloseModel(); 4 v/ H! |# |3 y# a* ?
WScript.Quit();
" y& O1 w' X( E( G. \5 @ }
# J0 J9 G: A$ e" H}
$ m4 j/ [; y [& h+ o8 k4 u/ J
M; E/ E/ r9 I, b$ Xsimple.StartSimulation(".Models.Frame.EventController");
; G) d$ U4 X( Z; M' n; o 5 M6 J- ~7 N G" B. V* C: E
if (simple.IsSimulationRunning())
! Q6 @3 a6 ^- b0 m& N9 z/ u WScript.Echo("Simulation is running!");
/ ~" m1 v, } a/ k1 E R8 O- s9 t7 N' `4 k1 `5 |
// Wait until simulation is finished : p8 r, z3 b2 _1 p: x: j
while (!Finished) WScript.Sleep(2000); 3 r$ d" r) k2 y9 O. |
+ f( g2 L. W: y8 B2 J
simple.CloseModel();
7 H5 u7 x6 t. y% T/ e* c( Wsimple.Quit();
9 ?( U v4 [. M: u+ j' \WScript.Quit();
, d3 L% U0 [" }3 A1 E0 H+ d : I3 z/ m% U+ ~2 `7 T$ `$ U) m
, [' b" x& R+ U9 H, sfunction RemoteControl_SimulationFinished() ; v& {; _% A/ m8 w! E
{
y( j' M* y: T WScript.Echo("Simulation Finished!"); |