Example of a JScript . Y! E I0 a* s% D$ A
var vbOKCancel = 1; & x; f2 J0 h" u( X" B! j
var vbCancel = 2; 6 p& j5 N H% I: t A3 M; }
var vbInformation = 64;
/ d e6 L1 O O% q8 q1 `, ~; nvar Finished=false; 0 m9 j$ x0 H( a2 s: \6 T2 p1 J
) n5 r( Z5 y( K- F! T
var WSHShell = new ActiveXObject("WScript.Shell");
8 F0 g4 ~0 h1 Q* `3 I# [. E
2 E% ]& Z. e! O# s' G# Uvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; ^: w+ q6 q# A
2 R' `1 T) O6 esimple.SetLicenseType("Runtime");
0 T0 u- t4 j4 U( E' z # v: [( N' _6 P' M, b# q5 e: M
try
5 G. u$ \9 @4 |2 t2 t{ y: X6 q! L3 a# c8 W
// Enter the path to a model file! . i2 |. l8 k7 k; g2 }
simple.LoadModel("C:\\Models\\Test.spp");
' M$ g# I$ F( n/ O/ {} 0 g( f; n9 {1 m8 F$ O. r
catch (e) + g1 L8 {/ O$ M8 W. A& V( [( g
{ ( Q4 {1 h" u7 T8 j* M6 |+ t7 X6 X
WScript.Echo("Could not load Model!");
. i6 a' Y& `& ] WScript.Quit(); / N: H; D+ o- k* o
} * s. F. e$ S6 G0 P6 o* C
3 m6 o$ k3 Q" ]% I% b9 k A
try
% f6 P$ k0 ]' i$ v{
. I: g1 U9 t- w simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 7 k% F/ s! J" i" K: Y y2 D' V
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
8 B1 @* j2 I! B3 e4 z8 Y# @3 z6 g if (r == vbCancel)
+ p( f7 h q7 s' _' y { 2 c, L- d" v6 r5 A; t7 n7 \
simple.CloseModel(); . O2 Q. w2 t% S1 D4 f4 L: j- U1 ]; J' z
WScript.Quit();
9 n: S& H2 l3 X& ~; X9 j( J- l }
) Q4 ^8 Z1 a" X+ t} % q* Y9 t2 U# }$ j n1 u9 A+ B) |
. t8 Z4 v& a4 ^/ A/ S, M# Ssimple.StartSimulation(".Models.Frame.EventController");
7 {; r9 `9 m! o1 p* l 1 I8 ]$ y8 ]4 C7 h
if (simple.IsSimulationRunning()) * z+ y8 C3 L& N3 F' k- v) z
WScript.Echo("Simulation is running!"); , q8 {9 P- ^7 M6 g
* J* ^& \/ w7 g2 G+ k+ @* w& Q// Wait until simulation is finished
2 n0 L8 c- W( ]+ U6 M, z! S5 Bwhile (!Finished) WScript.Sleep(2000); ' R7 A! x# Y* Z
! l$ K3 d9 ~3 c' ~/ r2 A( p
simple.CloseModel();
. K' w) i9 p3 U' ~% esimple.Quit(); - Q+ X2 [/ M+ s' W/ s$ A
WScript.Quit();
2 a0 {* } O) i- ~
4 M4 Y3 F: V/ d6 H# |
2 Y- k# p: m/ L$ J$ Afunction RemoteControl_SimulationFinished() - O6 P; w/ q/ t
{ - U6 f5 J4 b: @( A. d: K1 _
WScript.Echo("Simulation Finished!"); |