Example of a JScript
$ {6 [& r6 K: S5 K" s+ O1 L8 Pvar vbOKCancel = 1;
! F* N3 R) U ^& Q/ \6 O% Nvar vbCancel = 2;
5 h. P+ n6 ~) p3 Z. Z8 Wvar vbInformation = 64;
4 I. n: J- Q) u. P- d2 ^var Finished=false; 1 E# e; H8 G7 f+ T9 J
. C" a B2 \' @" j# E: [0 b4 [
var WSHShell = new ActiveXObject("WScript.Shell");
# k0 H3 M% l' ] & U: J: P# T: R6 @0 F
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
% ?6 [' I% L/ z' Z: X 8 p; f6 g: B) X5 u9 s2 h
simple.SetLicenseType("Runtime");
8 e) l" e% C. {
7 i2 u; `4 O9 ~5 e; z$ n) F5 d2 ttry
. A$ s1 _5 H" o{
4 f( `: |; Z# f2 ]6 I // Enter the path to a model file!
( R4 J+ \ Q7 Y$ }9 e# L simple.LoadModel("C:\\Models\\Test.spp");
2 ^9 n7 J {2 q6 o( j( M% P: o}
( t% V1 W6 L$ k- ]% J( _catch (e) 8 i2 G# k* x3 _7 [1 F( \/ D; a0 D
{
- q1 q2 n9 W$ e5 |7 I$ b WScript.Echo("Could not load Model!"); 9 ? O7 F) Z7 j9 u7 X
WScript.Quit();
. ^4 x9 }, k0 [+ {}
' d% C- G8 T- O" O, h) |/ P
# { a4 M" c" Otry
& [! z) z# |$ w( q! Q{ * x' }! G) | A2 x% W/ w
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { : @) U( w9 ~( s/ M: @
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ; Y, O- x) N, Q3 [& Q& s
if (r == vbCancel)
* |: \( W) i. I7 u$ V; K5 h3 Q* \ {
) F4 \$ V- z) M) @7 e O4 M9 U simple.CloseModel(); ( G/ L% x+ M; ~- [* R: c
WScript.Quit(); ) l- s& d) ], ]5 T# _1 g' O+ M
} $ ]( h# `9 i, K0 F& P) G
} / l# A) G$ `6 ?
( v% c' O# x2 \! `0 f0 p
simple.StartSimulation(".Models.Frame.EventController");
- P: F: p6 y* L7 ?0 g! M 5 Q/ B+ ^/ C6 F" g) m& B
if (simple.IsSimulationRunning())
) x. N- Z/ ^( @ h; J6 ~# H$ } WScript.Echo("Simulation is running!");
6 u# J6 Z$ e6 r 1 E) Q: u3 s2 D3 C) t' a# i
// Wait until simulation is finished 8 F; V1 a5 W! ~# G
while (!Finished) WScript.Sleep(2000); * ?) e0 c' g6 ]
1 b# F* A% o0 @9 R' n) ]! @7 Tsimple.CloseModel(); 5 H1 `. h: A6 O% y' f' f, `. I% }2 U
simple.Quit(); . v7 ` p/ D. T4 S0 X) a
WScript.Quit();
+ E. j0 Y# T" V) d; p , A0 a. X( Q4 f) _ l: s
- M' {5 e6 o8 r9 X" r. K
function RemoteControl_SimulationFinished() 4 k. k! |) P$ ]+ f- L; s
{
$ U( q) q4 V7 ?0 p WScript.Echo("Simulation Finished!"); |