Example of a JScript
- }$ G/ R; U) b8 [* gvar vbOKCancel = 1; x) x$ d; r. I8 C* k9 D
var vbCancel = 2;
& Z( ^8 A$ f6 z* R7 L9 cvar vbInformation = 64; 3 v& S5 y* N1 a/ r! T0 D6 I- L+ R
var Finished=false;
i9 y3 G5 T- Q & j6 |6 _- W5 m
var WSHShell = new ActiveXObject("WScript.Shell"); ' K2 s7 D9 t3 I1 T, \
! I* f- y" N+ fvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); & A, w* e9 s# y
9 b/ V8 p) t8 A% s" b4 z
simple.SetLicenseType("Runtime"); $ _0 n, F5 |) o8 X3 \
4 e# O1 m& k: M: A% c
try
2 Q5 H; W- V8 J{ % V: a1 {+ E! Q* m
// Enter the path to a model file! ! }3 S& k& e: C) t5 o! s
simple.LoadModel("C:\\Models\\Test.spp");
+ V5 Z+ @9 `/ R# U. d" T} 5 S0 P, @* d6 i& ?1 \
catch (e)
/ q& y9 \( ^$ p3 R{ 8 W- [5 e7 m) r# Y: l C: j0 j v
WScript.Echo("Could not load Model!"); y+ V; K' L# ]+ x! M5 N
WScript.Quit(); X. {6 y* X6 E# _9 u
}
! ?+ ^1 Z/ U+ N V8 [, }
8 T( F0 X' H, o* j A* ktry - b, {1 @; U3 F& }$ x+ c0 i: a
{
8 C) g; v- s4 e* n9 }7 _ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
5 J$ I# j2 a8 P3 k0 u+ L r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
4 w' G7 h( g& }3 {( _ if (r == vbCancel)
3 Y% B* w* }. z' R9 o% e5 q4 W {
) x+ f5 l+ W; E" L7 A$ P simple.CloseModel(); ) L- @# C& L7 l# c6 b
WScript.Quit();
. t8 G6 n9 @ q2 t6 E } * n! p, K2 R0 _% R; C6 d* M7 ?& j) |
}
; V; r ?; i& {4 I6 Z( P
+ {4 b( r0 R# P0 R: i9 u# q: w tsimple.StartSimulation(".Models.Frame.EventController");
7 D$ g- U" s7 Q9 o p6 V+ l
3 P0 A$ E+ c) T) oif (simple.IsSimulationRunning()) % E3 D1 {0 V5 V: L% s8 e
WScript.Echo("Simulation is running!"); 9 g9 K1 J9 k" E4 N4 h( g
* |" x& o& T( h( e2 I// Wait until simulation is finished
* I8 R0 c# `# Dwhile (!Finished) WScript.Sleep(2000);
% `7 A0 |$ R$ f" a/ e & n' x- b% f5 e2 l# D
simple.CloseModel(); ' i7 S* [$ P+ X2 |) A
simple.Quit(); ' y$ a" |7 n8 T7 _# ~
WScript.Quit();
n2 E: N% Q' v( \% }1 g+ R( Y
6 ?. O' t4 C$ n- p) t
! K% ]& f6 ~+ z! J3 Y3 I/ cfunction RemoteControl_SimulationFinished()
7 L5 ^, B* s% A" S$ L) J{ $ D; D- c$ `8 W; X1 Q9 Y
WScript.Echo("Simulation Finished!"); |