Example of a JScript
( N6 z0 b0 M7 |var vbOKCancel = 1;
2 V1 E4 r1 M, s P0 u6 [4 ivar vbCancel = 2;
+ b/ [2 S4 m$ X4 Z% Y- I) Lvar vbInformation = 64;
$ u- l" ]* h- P! Fvar Finished=false;
6 G" t" @' @; v# D4 {7 j, W) C 4 x. n. A, {5 W+ {* u% m& K
var WSHShell = new ActiveXObject("WScript.Shell"); 9 x; U9 q$ N. E7 j* V& x N4 C8 X
3 }5 N, q: Q1 Z+ |& w9 u% H
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 3 f9 O5 Z3 w& c! U& R9 v
% R* Y+ }% e$ D$ g, R/ v
simple.SetLicenseType("Runtime");
! |, R4 Q7 W7 k% `3 H/ _
/ M- U; c8 r1 h! S& \2 L( qtry
% B: p0 C2 a$ e$ ~{ : M, w# P+ s- Q" Q7 B, W1 i; K
// Enter the path to a model file!
' z1 I9 Z9 I& M+ B6 g) F4 i5 i simple.LoadModel("C:\\Models\\Test.spp");
$ f- y; \4 N' a$ A. s* r, K}
& s g' j" R4 k- U' icatch (e) / F$ U& K& e1 _% B: T5 q: a; K% v
{
+ j% L3 p) q3 f, u+ f' J WScript.Echo("Could not load Model!"); ! k6 S, Y; b1 X' f4 I
WScript.Quit(); ( ?) X3 ?* c( i+ v- n
} 6 P% N# S' O4 N; o. G
( T: W6 d* ]# p V( Jtry
/ p: d: w7 j/ [3 p V{ # k7 M( {9 s; s5 b2 }- t6 w
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 1 @; @; w0 ^( b9 Y9 n) w
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
. A' p* T4 s/ K$ F2 N: E if (r == vbCancel)
7 D9 Z0 S! z5 Y- z; U8 V7 ] {
: F" M+ k+ x+ u, r7 u1 A* H simple.CloseModel(); : G B. R" ?8 t( G) {
WScript.Quit();
( H h, l C( R/ h6 |4 X7 R+ x }/ | }
( n( f7 P% D1 b} , T8 {" D+ x" V# A: o
# V. _: Z5 U; n7 ~. ~6 \0 y* }& {simple.StartSimulation(".Models.Frame.EventController"); 6 b& u; W( y% `% |! O
% Y& X9 q5 X! J7 _! ^
if (simple.IsSimulationRunning()) 9 ]; P% s* n/ U4 a
WScript.Echo("Simulation is running!");
& M" _ z$ R3 o# P! B( \; D
5 Y+ j* s% q$ @2 q! n$ ]' P// Wait until simulation is finished 6 h0 W+ h! E3 J+ K
while (!Finished) WScript.Sleep(2000); 6 Z$ U3 X4 Z: K
- I4 J) R" k! O, t+ h
simple.CloseModel(); 2 U2 q4 y; U# N4 {
simple.Quit();
- P# ~4 B6 e. p7 z, u+ q( vWScript.Quit(); ! g( x! I, u7 E. G& z
" O% a$ c! w' ]6 c0 ?! N
% L( n: Q; a3 z+ L U/ Efunction RemoteControl_SimulationFinished()
& a) ^; |+ w3 d. z: m{ ! o+ v8 h" i. v6 I6 Q R
WScript.Echo("Simulation Finished!"); |