Example of a JScript 5 Y3 U7 l# n3 ]4 p, Y/ t
var vbOKCancel = 1;
5 c' R7 W4 B# e% T1 d, g' nvar vbCancel = 2;
( E" o7 S5 U$ i) w. T Qvar vbInformation = 64; $ E8 a* a/ z7 D% g) K8 p
var Finished=false;
, f+ S+ E% F- p; t- f
' p T- Y9 {+ r! o. p# O6 fvar WSHShell = new ActiveXObject("WScript.Shell");
4 k9 [2 z x, o4 @ B
; Y* d7 y9 _( G2 _5 w: Jvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
+ B; a( z6 t, E7 m
0 b/ w' `5 U7 S G2 p) Z0 z! ysimple.SetLicenseType("Runtime");
! u6 Z6 _' w+ e" ?, N4 D / t7 @3 x9 A3 B" h! E, p
try
2 x' H @% s v2 B& ?# q{
% Z* J: P# N5 h // Enter the path to a model file! ( N2 s! ]5 j6 e7 Y& F3 ~
simple.LoadModel("C:\\Models\\Test.spp");
2 L6 d" ]/ `3 H( R}
! }( m, y0 N0 ^catch (e)
& ?3 `- |) y1 U% I( X0 E{
+ W3 N) [8 U9 q WScript.Echo("Could not load Model!"); ]( F5 G8 s7 E. Q3 x- v
WScript.Quit(); 9 E2 x# I( G, B' r. S; N
} ! b- o5 Q) g$ `
. \, c. U: H: i8 Y. O. a2 k; N4 Dtry
+ E$ R7 w+ m8 E' U( [' B{ / n) P4 P' T3 s0 ~2 N: \4 H
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
2 N# }# G4 ~+ v7 r/ R+ x6 N r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & f) s' L p( H$ @1 x
if (r == vbCancel) & F0 w4 Z4 B0 T0 }% E% s0 ^
{
% ]) _7 h3 T0 W- i2 C/ z- j9 A simple.CloseModel();
9 T7 b; [! _7 ~0 R! T! g WScript.Quit();
: X+ v# f) x5 h* i5 k }
! B; ]+ a/ L. l @- u$ \! e} c3 W/ F, s- v) @1 m& E
5 H, g F: {5 `, I, j! A4 asimple.StartSimulation(".Models.Frame.EventController");
6 ~7 k, e/ e: E2 C) U
2 m' R: C- u+ ~3 {if (simple.IsSimulationRunning()) 3 q% o7 e3 f# t0 R
WScript.Echo("Simulation is running!");
- e! [* ^# H5 z8 k h" m) b7 k3 r ) k. r' s" n, X+ h5 B
// Wait until simulation is finished
+ Z* u) r# d( P7 K8 B: r8 swhile (!Finished) WScript.Sleep(2000);
. ?0 l6 [: s) x t) V ! }% g$ v+ r; p
simple.CloseModel();
- W2 ]/ b6 \7 c$ A/ h. e5 Zsimple.Quit(); 2 {1 f- w( ?! g
WScript.Quit(); : s; F) G: ?# J& J
5 ^& l' m% ?2 W
( H/ D3 U6 e4 D! {function RemoteControl_SimulationFinished()
1 S" B# k: O% z( F$ i8 O ?2 q{
8 N+ r: [* G2 R. H WScript.Echo("Simulation Finished!"); |