Example of a JScript
/ x( T& F3 w! Qvar vbOKCancel = 1;
& s4 ^$ Z+ [/ U* {var vbCancel = 2; 8 f! R0 a1 w a8 f/ y6 H
var vbInformation = 64; ; Z; g( Q U& I9 z% I# T
var Finished=false; 4 I6 Z r) G1 `4 M* @( U' L5 n* E# }
& f# f9 U, e- M0 h; H# b2 `
var WSHShell = new ActiveXObject("WScript.Shell");
5 v+ L9 O# w/ }. }5 ?* l
, M% |' c! Q2 G! x; ]) z2 V# fvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
: T6 h- D! x4 q; V: J 0 S( K, i8 ?, @
simple.SetLicenseType("Runtime");
* l9 R9 W7 b: K! }& K+ t
: i' \4 t% J N# z8 Ttry ( V, Y1 J) U# W9 J% s
{
) v& Z& S7 a5 g // Enter the path to a model file! $ ?4 w7 [3 y$ u! [! A
simple.LoadModel("C:\\Models\\Test.spp"); 0 X" C- K( o& k' x- C. O2 P
} + w5 n n1 |! Z1 Z- e3 }! b0 G& H& c
catch (e)
7 b. u& I l8 @& A{ $ [ t: L! S3 S0 @9 t
WScript.Echo("Could not load Model!");
/ w- c5 l9 o& O4 b5 i% q j; g WScript.Quit();
. W" `0 ?# W2 A: p3 X( U} 6 a1 `$ B t% O' m
# J A" J" F1 f" m1 r1 V. o( e
try ' J% f) n3 z# X z
{ 8 ^7 C L2 Q+ L
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
3 P4 g0 s! X$ t! G r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); / b: n" F1 _; C- V4 [
if (r == vbCancel)
/ e* P" H! o, t0 T {
D, D3 }+ m' C' |$ u simple.CloseModel(); 5 e0 r- x) n7 Z- ~7 w
WScript.Quit(); / x9 p' \' n1 _
} & ? w3 A! Y$ q
} ! y5 {5 K% @, ]1 k3 D
7 h9 w# K5 d2 ]0 o7 gsimple.StartSimulation(".Models.Frame.EventController");
6 `; W5 ~! o+ W , ]: T0 n. I4 I4 x! V: B7 F
if (simple.IsSimulationRunning())
' F( v2 U& p2 N* o4 n! g WScript.Echo("Simulation is running!");
5 }8 [. L5 U4 S' z" k6 k ) A0 h9 b1 e0 r4 w% q3 R) g
// Wait until simulation is finished ' O( g9 x6 L$ U% _! ?7 n( A
while (!Finished) WScript.Sleep(2000); & }( O" S& [- S) v* c; p! j9 [- R
3 i+ i& |( C3 C5 C( O6 \
simple.CloseModel();
* f" f; J: H1 J$ ~; X1 v6 O7 k( Psimple.Quit(); / M% Q) f- r; t* O: F
WScript.Quit(); # Z4 b9 D$ K6 i$ }, G: P0 n
- I" t/ K4 T1 N6 x2 b 1 I, P# o( i" M
function RemoteControl_SimulationFinished()
) F5 m; K& b- y" n{
* X" x$ ?. W$ p: \0 {5 A; z% M1 b WScript.Echo("Simulation Finished!"); |