Example of a JScript
5 y( m1 w; s6 uvar vbOKCancel = 1; % k8 ^, T6 l; ]; ?, c9 v2 P
var vbCancel = 2; 5 F: `3 O. V0 i- x" P; a {' C
var vbInformation = 64; ; O. v" v6 U, L9 e; r" C
var Finished=false;
0 H5 F, e+ s9 K : M: k( f4 F, h% V* V0 k- r K8 [* Q
var WSHShell = new ActiveXObject("WScript.Shell");
8 ~9 l0 Z B1 [$ G ) Y% R+ n2 }2 T! k. r
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); + |0 Y4 |# `9 }. r+ S V
8 O9 Z9 g6 k, g6 E0 {: p+ J0 C: i
simple.SetLicenseType("Runtime");
- U/ y( F" m) O, S1 i, d( K 6 X1 ?3 T1 X2 p5 e( d; [' h, }& ~
try 0 W# l6 T2 \) h- L m; h
{ ) \. u6 u1 o* p0 t
// Enter the path to a model file! 6 `; L6 A6 z+ F0 n4 f- _2 r
simple.LoadModel("C:\\Models\\Test.spp");
" h7 x* `( Q- `9 j% `, e}
$ J5 V" ]8 U5 o# tcatch (e)
. @. ~5 I4 O3 T/ b. } B{ ! o( v3 {+ r# Z1 U' q
WScript.Echo("Could not load Model!");
6 b( n9 c s% G: g WScript.Quit(); & O% K7 L7 }9 ?1 ?* z% b( S
} 6 }3 [$ {% |: k$ o6 d: l3 U- Z
) W5 ?- ]* A C/ I3 n, m( \try ' A& q Y' F/ ~" i ~
{
' ?( d' ?. O% |- t! p# q3 E. o simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { + N' ~0 B. D& A8 O2 R: a2 P' A
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ( h) ]0 v( T) P9 M; a% _
if (r == vbCancel) 1 G1 N; @4 x5 l' X, J* @
{ 0 E1 P3 B5 i5 L _$ L
simple.CloseModel();
5 Z$ i m; F: u2 |3 H2 ^' q WScript.Quit();
7 N& i2 K7 _' A7 ? }
# t2 r8 |$ @# U; o# ?% \} ! Q" I$ e! P0 R
- N; J5 U: g! R1 Z* a/ p( zsimple.StartSimulation(".Models.Frame.EventController"); & r/ I/ G- K/ H) r3 d
5 M% o" {) s# M7 T; o9 b# v& Uif (simple.IsSimulationRunning())
! X% C; D& s4 g; u WScript.Echo("Simulation is running!"); 1 d/ `, O( g- v. y# C( I
2 y& W& r C' ~2 @. k h" Q// Wait until simulation is finished
" c! ^, a7 G4 {5 Fwhile (!Finished) WScript.Sleep(2000); & S: b) P9 N1 K% T5 D, c
! ~9 I* G. W5 jsimple.CloseModel(); S# [ ~ N" y5 n
simple.Quit(); : r- f7 @7 E7 R- X2 c4 R
WScript.Quit();
9 \! x$ p- B& l' h / E$ W/ R8 y o4 r& A8 @+ i
. p0 y+ ~6 D; \% Y# R- B4 j6 Pfunction RemoteControl_SimulationFinished() ( f2 n. d/ ]& x. Z% I; o% n
{ 6 M! R6 m2 `4 ] R3 N8 J4 _1 @3 h
WScript.Echo("Simulation Finished!"); |