Example of a JScript
6 {+ y* R3 `3 W- X0 Vvar vbOKCancel = 1; 9 r8 k1 U6 \$ a
var vbCancel = 2;
7 v: h* ?+ ~# ]; nvar vbInformation = 64;
) A+ d" L X% |2 Q# t4 f+ Ovar Finished=false; 3 Z& i5 k! {! g. n/ s& ~( z. u' K+ M
! w) [. L Z- I4 o. U' wvar WSHShell = new ActiveXObject("WScript.Shell"); " P/ F9 P$ @' M$ }8 H7 c
* L% m, F# X8 S5 x6 N
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
' ^- T" G6 Z; @: U* O ! w$ S3 d! ?0 i. f9 \# d
simple.SetLicenseType("Runtime");
( S4 L+ {2 j8 k/ F- N0 _
5 |$ z Z4 h; Itry
$ G3 L) Q6 K* z$ l# L{ & o$ O& O7 e. _4 g2 C6 X/ b# @
// Enter the path to a model file!
; |( n3 x Y% x& Q4 H+ C9 P simple.LoadModel("C:\\Models\\Test.spp");
9 K, X/ H7 Q' G} ( P4 {# w5 G- | r/ a
catch (e) : ~* Z9 R# ?3 k1 M1 h
{
' |% y2 E8 W6 w# G1 O7 ?# d- p WScript.Echo("Could not load Model!");
4 r' P5 |& k' R" c( e; p WScript.Quit(); ; w3 Y2 Q: R/ S/ M k8 ]/ O
}
9 U) d$ g4 N+ v! W ! b L- X& r: H: W2 D
try
. F* w. e$ \6 M2 i& R# ~{
" T J* G E+ |6 r simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 8 N) R* g6 L; o! ?5 Q
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); : [/ |; p6 A! D& N3 O
if (r == vbCancel)
! h( k$ `* o# u* U& {9 q {
# g e8 y2 A$ W' B0 y simple.CloseModel();
% F' t2 a9 m' p: { WScript.Quit(); + S2 |; I* q8 ~0 H1 E* @
}
" l1 R/ b I# y' `) v} : a* {- g: H/ x! X4 w4 }+ C, w
, i& G6 Q. ~* s, jsimple.StartSimulation(".Models.Frame.EventController"); . u! k" j5 ^; s: c5 k5 W6 `7 Q
* f9 ?5 x5 w: R9 @2 K
if (simple.IsSimulationRunning())
" C. b e! u) m1 f4 ]4 X, C WScript.Echo("Simulation is running!"); 3 g# q; C: U9 a% [+ c
/ O# B% }" |) |( p
// Wait until simulation is finished 3 Z" d3 I2 Y$ Y
while (!Finished) WScript.Sleep(2000); . f2 T* {- g. g2 V8 H
+ ?! {* ]3 {: Q# g8 L
simple.CloseModel();
4 f6 s& A" A9 o* ?6 z# lsimple.Quit(); * a; o: k- @2 E0 B
WScript.Quit(); 4 {3 b2 W: o! z; g5 H+ W
( Q) `: N4 G' u: H; u
, M: d1 o5 {0 y- U# p% W$ M' y7 Ofunction RemoteControl_SimulationFinished() & n- t% S! L: x2 [/ p* F6 @
{
4 ^: a; T [" ~, n9 { c WScript.Echo("Simulation Finished!"); |