Example of a JScript
/ E1 q& X6 @6 m mvar vbOKCancel = 1; % v; _+ W7 G3 ?/ x9 }
var vbCancel = 2;
, Q/ D0 Q2 K. H9 I' }' Hvar vbInformation = 64; 3 K) O7 Q) F3 z+ J
var Finished=false; - W! n( r. ^% G( J& G0 j/ K
' a; M# {- _9 b$ \" C7 v: k z
var WSHShell = new ActiveXObject("WScript.Shell"); ' d1 b& T* V' [- L
! i: Y; C+ F- t) I4 @var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 2 q- x1 B, P# M: L2 S! {( [$ r
: ]1 w1 P0 S$ x& ^: D2 A+ z4 f
simple.SetLicenseType("Runtime");
1 L2 Z( ? F) e: `9 v7 o " W/ R: r$ w2 Y; |, p/ x
try ; B% \; y' w, o! r# R6 |: B1 d: t/ R
{ 0 T4 i0 f8 T, j) }: i) H; U H# W4 z
// Enter the path to a model file!
$ l4 S1 K+ U# N, y, z9 X1 `- q simple.LoadModel("C:\\Models\\Test.spp");
' g; y; X8 C# Z0 P$ f& r} # X$ e6 L: c2 Z7 G0 u
catch (e)
: S; J2 c6 f V! \8 X5 ^# z{
7 s9 X+ w* G1 L1 ]- N WScript.Echo("Could not load Model!");
6 W* t% s _; F WScript.Quit(); 6 D2 t. M7 Z" a2 M
}
) ]' F, C- B Y3 o
; }' t! `9 u6 ~- Q: P S. z* W7 gtry 8 g& s( D8 Z4 I
{ |5 j( E+ m/ O: U
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
2 J$ h; B4 |6 p r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ) S" Y1 i x; g% o
if (r == vbCancel)
4 I; x4 U- p D {
$ E# _- x$ A9 Q$ N. ^ simple.CloseModel(); 0 x2 o( }% d, l( S" R
WScript.Quit();
9 I2 d9 J+ E5 g' _ }
6 N0 m1 U( r' n: s- B% O} 1 [4 C8 @( Y$ {" I
$ e, ]8 H p. p; ]6 p+ S/ k$ {
simple.StartSimulation(".Models.Frame.EventController"); 3 B# s1 B$ O% k3 |0 \- `. h- o
8 H- v5 ~4 z: C5 K* S5 b/ k; V( ?
if (simple.IsSimulationRunning()) * c6 j& o5 {* D% V1 i- n
WScript.Echo("Simulation is running!"); . B3 n2 n0 D* y' U
( P5 A. ?3 ~2 j5 t( r# H# A// Wait until simulation is finished
, n' B! H4 w8 r; t; m qwhile (!Finished) WScript.Sleep(2000); - u. z! X2 I b2 {: q' ~
8 T( z, W( b# `2 `" X0 Dsimple.CloseModel();
: g5 c9 M8 E. j+ y4 X, {simple.Quit();
5 h5 X+ V% `" x9 }WScript.Quit(); 1 [4 e3 s& q* M' a" O: O
' j( M* Z5 W) l& m; V6 o. B# a ! }& X3 E J" A' }
function RemoteControl_SimulationFinished() + X4 |5 B. G G8 u6 G
{ 1 `8 p9 a/ { p$ W, j8 {
WScript.Echo("Simulation Finished!"); |