Example of a JScript
; z4 J" F' P: c0 J% A, Q( u$ H3 mvar vbOKCancel = 1; ! F1 t- }% r1 B" P0 _. A( b6 K
var vbCancel = 2;
! ~+ T6 L8 N& i4 f8 }var vbInformation = 64;
' x0 x7 A/ a3 @6 \+ s% Uvar Finished=false; 0 \% i/ S8 G% A/ q% V8 v( {5 T% W
( ~0 m' W9 h2 C6 F& J/ @8 i2 L; c
var WSHShell = new ActiveXObject("WScript.Shell");
6 A' m. a# W& F, X- d
7 p7 h- u/ k* k; n' Yvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 4 O* @/ ` W: m
" k2 l, j- r: h+ Y3 S. ]simple.SetLicenseType("Runtime");
' {- U9 A5 @' g* R9 b( N! x
. E3 d- z7 N* k2 R R; Ytry
% x e2 o: T6 F. S{
. b. x/ D( h+ O5 b9 d // Enter the path to a model file! ) b2 a. L6 w+ _* C: Z
simple.LoadModel("C:\\Models\\Test.spp");
+ M* W5 I6 Y8 f# f# y}
6 ]7 q2 @# r* r; K2 kcatch (e)
8 ~! [9 G5 K2 Q: B/ v* K# I) g' E& A{
s" o, y/ {6 D: y; u8 n2 _ WScript.Echo("Could not load Model!");
0 O9 I+ j7 x4 V4 T WScript.Quit();
" ]6 d3 P7 ^, a* |: m/ Z} 5 M. w8 b7 L" R8 N% t3 n M
6 L( W2 ~$ \/ f& Z! j q- l
try 4 K6 }# a/ I0 c: ]* T) o
{
* E) W1 r; n) ~) T' v, b simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
0 K+ ^$ l6 b% w L) x) s r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); - B. Z) S, v9 e6 d
if (r == vbCancel) * D. _) y/ y: K* A: p; P8 m
{ / D& j1 \+ s: o
simple.CloseModel();
6 Q+ L8 J$ m$ l2 f w/ N WScript.Quit();
6 N6 V9 u$ @; t$ J. q6 J } : C( d1 b$ E! m4 T3 ]! ?
} - }2 R. _8 R* H+ v, w/ h
. ]9 L: y" C* msimple.StartSimulation(".Models.Frame.EventController"); 0 S7 x+ u3 l' L7 I
8 p2 Z$ ~2 m! S4 D; Sif (simple.IsSimulationRunning()) 6 Z+ u7 G7 j% K, f q
WScript.Echo("Simulation is running!"); / a+ `6 n' }) l) Q% ?
5 z$ t; ^* K" J0 _6 v( R1 I& U5 H }
// Wait until simulation is finished 1 Z" n8 T, \5 Q' U
while (!Finished) WScript.Sleep(2000);
( x8 [# N: Q3 c3 Y
1 ^6 V% p8 f% I) o& t& csimple.CloseModel();
}/ I4 {# H( @! fsimple.Quit(); ; h3 m( C1 G' r) |, p1 R3 A0 I
WScript.Quit(); 3 _8 c0 x5 m; C9 ~6 o
5 ]% v3 ^" C; n& @4 `5 ^
{9 h2 |1 q# s5 C" Bfunction RemoteControl_SimulationFinished()
' Q7 W" C' {% D& |( j{ ' {3 C- v Q& I: n
WScript.Echo("Simulation Finished!"); |