Example of a JScript
" k& y$ t* W( _5 ]( F. xvar vbOKCancel = 1; ) U5 X" ]# U! L2 d
var vbCancel = 2; ; ~6 ]( m: U# k
var vbInformation = 64; # v0 |" \" k& p
var Finished=false; 0 T3 f3 M' c+ l# x* t! C5 S
$ m3 D& R3 v5 K: \
var WSHShell = new ActiveXObject("WScript.Shell");
2 \& Y) N* A- T" P- _
. o: b/ U5 l1 h# O3 \. L( l ovar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ( c4 |3 p* W1 J$ `
& G6 g+ u+ E8 F% Fsimple.SetLicenseType("Runtime"); " H" B* e& O6 s$ T* \
% C, `6 s) k2 l2 M* [" n: ftry 2 }2 N8 y( [6 R* h/ H
{
$ x4 [7 F& c2 W // Enter the path to a model file!
' J& A" E/ f; m simple.LoadModel("C:\\Models\\Test.spp");
: }- m+ p6 H3 c. Z( K} Y6 K# I p; w6 u2 w% C
catch (e) , l4 U& |" Z. p. h3 ~
{ + n& J+ D% ~* Z2 I
WScript.Echo("Could not load Model!");
2 [% ]) B" n0 X+ j WScript.Quit();
9 R5 o; M( W2 _) Y5 J* J} ; g! J" z, k' \/ p1 {
# H0 v( q7 O4 l* X( ~try
, `' T* _! l L( L& e{
: I! I+ \% R I$ d2 \6 h simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
* A3 s1 ~" D7 `, ]/ S r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
: r# V5 X. M U& g1 y. M+ c0 [ if (r == vbCancel) * Y8 [6 Z, c4 U2 a
{ 4 Z8 q. V# {2 o% p. p
simple.CloseModel(); 1 b% O5 N) F. k V
WScript.Quit(); 5 Y+ v! w- ?% w' K1 @% R
}
4 F, M3 D# x# Z2 K}
/ _, ?5 L0 R$ {2 x: ~! e: L+ o
0 x7 y# ?; U9 f' I# bsimple.StartSimulation(".Models.Frame.EventController");
) | Z- b8 ^: e( b1 Q. e& u ; v6 ~) ?2 d! Q3 P
if (simple.IsSimulationRunning())
; q: Y- }* E# w7 y WScript.Echo("Simulation is running!");
( I2 `+ }! F. v5 u" Z) `8 y5 f
7 K2 X: q3 J- F9 @# u' b" ]: d// Wait until simulation is finished
0 l8 ?% q7 z$ x- _8 r3 Lwhile (!Finished) WScript.Sleep(2000);
3 R. Y% t2 h' y2 Y3 g: U5 w; \
' ^( Z! I9 f/ E& Zsimple.CloseModel(); , c4 l* W @' K* {! C
simple.Quit();
: {* j8 K$ f5 _& e3 k; {" AWScript.Quit();
% Q, _% @7 ^5 l ( Q/ z5 K$ C. ~6 g- Z' U( s
9 n3 e7 g4 ~9 {; w1 cfunction RemoteControl_SimulationFinished()
. \8 v' S! ]; J4 r( Y{ + d1 d( a% i8 d
WScript.Echo("Simulation Finished!"); |