Example of a JScript , c) `; p+ R% e
var vbOKCancel = 1;
! L& Z' V% E- C7 a7 {! g0 Kvar vbCancel = 2; " a( T6 k7 v1 x; p
var vbInformation = 64; * ~- ~+ g$ Z- S5 P' S
var Finished=false; 7 G; g6 l8 Y: u0 m
. [1 I& D% q! ?( V; N. b
var WSHShell = new ActiveXObject("WScript.Shell");
( f1 p; c! `7 g5 S% o5 O
0 f Z' p8 i, E Kvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 8 P7 T% y/ m' ? f- `2 J
2 O) { _' e; W! Ksimple.SetLicenseType("Runtime");
& K' s) q5 _3 P. \3 i9 N Y
' p8 {# r9 y5 ~! y# C* h7 ]try N; G/ s+ C8 A& K0 o7 B' v
{ 3 l0 y$ ?& \) n4 T' I( J
// Enter the path to a model file! $ y0 w5 @: `0 ]6 M' v8 A
simple.LoadModel("C:\\Models\\Test.spp"); 8 h3 |) }" i9 Z' O5 s6 [
} 6 d! k1 g1 g( n& ~& y
catch (e) / Q9 j6 d& E: w/ [; z1 `; x5 @
{
& A h) J3 @5 i2 N% b WScript.Echo("Could not load Model!"); . A W0 {. C+ y Y" Q. A z( F% n
WScript.Quit(); 6 A. [* h3 K) C; [& [
} $ }5 s( b5 b. x: r8 B# H8 d
/ X. k. n$ s4 O& O9 D
try
/ U \) N: f% e- g8 r{
6 i4 ^' l; |) S2 A8 H9 k# r simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 7 G4 q8 m$ b. P# F7 q5 E
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
- o- r+ S. R* y4 X if (r == vbCancel) + }4 P% ^$ {( O0 y) c
{
X4 s f9 A( c simple.CloseModel();
9 T& c5 h- M6 T2 W; C" L+ S WScript.Quit(); ! L/ M( A7 [5 e- h: ]) n
} ' R; Z. S6 I, m& v: `$ N
} ; c8 p$ i- a4 n& c" U
+ ^* U; M1 H3 b/ N5 l- Y
simple.StartSimulation(".Models.Frame.EventController");
. P" N; V* X; Z% ]7 L l7 w* k9 E9 C+ U% ^2 F
if (simple.IsSimulationRunning()) x, u4 @/ h, @
WScript.Echo("Simulation is running!");
& E3 A! Y# R, V; |; r% p , o5 l2 v9 @/ J3 U
// Wait until simulation is finished ( m- d" ]6 e, F: B# z( r9 [
while (!Finished) WScript.Sleep(2000);
3 k" k$ s) A2 G/ Y
5 [, T, |- D1 T O9 s) R4 ] Msimple.CloseModel();
' g: B* C" w. i' z# t7 d" n" Osimple.Quit(); " q3 L+ e- Q4 P3 u
WScript.Quit(); + ?* e Q, |; {4 N3 [. t5 w- L
& d# [% l# [* ?6 t( M ) f) x: q" r' Y3 R" g8 ^2 k
function RemoteControl_SimulationFinished() 8 Q, |- k0 D8 x% s2 s# n0 q
{ # K$ q. v2 q5 T- D% \ L; b
WScript.Echo("Simulation Finished!"); |