Example of a JScript 4 z9 j7 u2 O$ v# _7 b
var vbOKCancel = 1; $ r& Q" P5 Z6 G& Y
var vbCancel = 2; 5 Z7 U5 v* W: `& U) ] {( j4 X+ A
var vbInformation = 64; " \& Z- X" r8 ?7 i5 t$ g
var Finished=false; 8 R2 V) Y# P, d
- ^, G1 s' R( G2 Tvar WSHShell = new ActiveXObject("WScript.Shell"); , w: @. f& B7 j# N J1 p0 Q
# H) D" i' W' K' evar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
' N- S" d ]5 a( @( S# T 1 F1 b" O' t% ^. H
simple.SetLicenseType("Runtime"); + U! w) Q$ X* f. u6 L' I3 R
) V& W$ O' m5 K3 ^# d/ B- \6 f
try
& n. V1 Z/ T# y5 m{
! s9 H) j0 t. t D // Enter the path to a model file! 8 j7 R& _! H3 X/ g7 U) s o0 Y+ e: J
simple.LoadModel("C:\\Models\\Test.spp"); # j' M4 {% r# n% [! `
}
2 T6 Y0 Y# W! F- r$ e9 A: ]catch (e)
2 t" P: p: i2 H{ a' {# [7 _/ N: |9 d+ U$ Z0 o
WScript.Echo("Could not load Model!"); . h" D/ N4 S- O$ _. N. q, b
WScript.Quit(); ; K6 T6 G- d4 U2 ^# y
}
& d$ s4 q0 B8 ~
( g$ n6 |0 X2 O6 Y6 btry
9 A" N. K2 X, A) S1 i{ 4 z7 L) I1 }# ?" s
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { " ~0 b( g5 Y1 ^! O4 p3 a5 t+ q
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); , v4 C5 V/ Y' j, J! V0 i/ f
if (r == vbCancel)
# \' ~$ E3 b& X7 b& S9 M { ( d* _+ b9 x& V- p' M `
simple.CloseModel(); 7 e q& R- g- B1 V" p, i( T
WScript.Quit();
* i8 r9 u* }1 o6 E# S# y } ) O( z) F/ a- A# i/ `, {( j
}
% F! P$ [" g7 O 4 H! H' w$ C' s3 Q
simple.StartSimulation(".Models.Frame.EventController");
( Q0 l* `2 u8 l. k ' X0 s/ [ v9 Q% F' x
if (simple.IsSimulationRunning())
4 b! g" d! x/ K) a8 m: b WScript.Echo("Simulation is running!");
( z2 h$ C$ B+ m+ o2 R; N9 s
% A( U2 ?+ y# t9 ~: H' |& w5 K& V// Wait until simulation is finished / `! W) {/ Y* \. I& j' S( m
while (!Finished) WScript.Sleep(2000);
1 ^- W9 Q3 J0 A( V 8 l) B f* n1 e: ?
simple.CloseModel(); O. y; I* g- [3 v
simple.Quit(); ! e9 Y) |8 @& M6 n& Q
WScript.Quit(); 4 R: H5 c" u$ M7 S: Y2 q& Q& P: d7 ]
+ q# q$ L2 I9 c% D2 J- t
7 t+ ]- n; b4 I8 P0 Efunction RemoteControl_SimulationFinished()
! N- _- T5 r" R) Q; N8 R) Y{ 3 X3 E/ V; n% [3 Q+ A0 ^. I# c
WScript.Echo("Simulation Finished!"); |