Example of a JScript ) [ M/ O. ~; R) O, Z# y- [
var vbOKCancel = 1; : E+ a9 h3 s6 \7 e7 r+ q
var vbCancel = 2; ; H! L: a/ C1 `: M. p% s( a
var vbInformation = 64; 8 \, t5 R5 ?6 Z" A4 W% P1 W; C; ^
var Finished=false;
$ m4 X, t& ~$ u; J5 l 7 w; R( w. w" j, {$ G! T
var WSHShell = new ActiveXObject("WScript.Shell"); / r) t5 g1 R/ Y) S
: q- ~0 |( @: v/ f5 S0 Z
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
% F- R/ A5 L% Q, y( l' ]; Z) n h4 [% f2 M" D; V+ `' }+ g
simple.SetLicenseType("Runtime"); ( P; W! E$ q L1 \$ ?" S( T
4 H( s0 j& v1 n9 Vtry 0 y, C- V8 n4 d& w- V% E3 x
{ ; P( n: j" m# c' `6 P# R2 F
// Enter the path to a model file!
2 t; U% F) C/ E$ `+ D- o simple.LoadModel("C:\\Models\\Test.spp");
7 k# N& C, I1 ?}
# s2 L- @; e' \catch (e) 4 S$ N& m9 c) M$ Q) p" Y
{ % w& e: x! D" X0 b9 ]1 {
WScript.Echo("Could not load Model!");
; W1 f. z V0 U8 X. B WScript.Quit(); ) Y6 n, ?9 O/ |0 j
} 0 s: T M* {) p* u+ D' K
" J( n, v8 j; q0 [" B2 f
try % ?8 W; n7 o0 `2 y2 ^! J& U1 I
{
. g% P0 E" P# a8 F' S simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 4 o; w2 b3 g& D* h7 O: l3 \
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
" I5 K% j) n2 L2 ~# J if (r == vbCancel) 4 e; n- F7 g! }1 E) Z
{ 5 k4 F* d/ z p
simple.CloseModel();
8 O5 c6 g- a, C* U! z8 v WScript.Quit();
0 ^) O$ Z3 ?( n- e& P } 2 ?8 |0 ]' a1 |( X( L
} + Q* _* r$ V4 K( z: ?
0 Z( _8 D, f Z0 P
simple.StartSimulation(".Models.Frame.EventController");
, O1 p7 e( d+ ]9 [
/ q# @6 s# D) u/ d Fif (simple.IsSimulationRunning())
4 T7 `, j: z% T6 X# T3 g WScript.Echo("Simulation is running!"); & F- a0 z/ x6 d
. b A& D" }( ^1 w( Q* s: [
// Wait until simulation is finished 0 {% U5 _. }9 A- M6 N2 S
while (!Finished) WScript.Sleep(2000);
& d7 W) p7 o2 t 1 x% P; L. y, R0 Y) A
simple.CloseModel(); m; U" |8 P8 a$ `8 N
simple.Quit();
! w. |+ Z( ]2 p$ t( SWScript.Quit(); 8 E1 V! T: B( V! `1 C
m3 N T. C, ^3 O
X6 `* |/ w6 T/ i8 gfunction RemoteControl_SimulationFinished() & ~5 I& L) [& K( c6 {% g- h
{
3 ?1 Y, W7 J0 r1 j8 }' N$ r WScript.Echo("Simulation Finished!"); |