Example of a JScript
* @- K- S+ L5 |var vbOKCancel = 1; 6 {! H9 R6 Z/ a3 v
var vbCancel = 2;
% U. D2 [( {9 Q ?3 Uvar vbInformation = 64;
+ i, Q- V* Q7 ]- u0 bvar Finished=false; # z* o* H! Q( N9 W
2 f9 |! c* t) {6 T0 t) R1 E; o- Z
var WSHShell = new ActiveXObject("WScript.Shell");
& o0 Q1 p' Z& R 8 z4 m4 R; z( u, M% D/ q9 H
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
4 t) e1 M) E0 L- m ; h6 I/ @4 h' [, o. K+ c1 d% Y
simple.SetLicenseType("Runtime"); # X( i" u! e& O6 q _) ~
: d8 W0 Q! T$ Rtry 4 m, `! J* Q, [* ]
{ / O/ T1 P7 W) @- q/ ~. u& J# Q
// Enter the path to a model file! : e5 [. ^. r x
simple.LoadModel("C:\\Models\\Test.spp"); % Z9 ]6 W3 z+ ~! b" ?, @+ s
}
$ C# a0 k6 ~- ccatch (e) ! w: s1 f! [8 D* w5 d5 e3 |' R* C
{ 0 L. c/ Q. T" ~& |! w, \
WScript.Echo("Could not load Model!");
- u" b0 r4 }* s5 ~8 m WScript.Quit();
; j* L2 e% ~! b9 l! a2 y5 Q$ c}
! m1 n; Z3 O& ^2 V5 q$ E: w ( k- g `! R9 a9 A" J
try
7 Q9 b9 n8 F: d: a{ " S6 E# K: |! W; V& [$ Q, R+ w" S
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
7 Y" R" I% {+ [* v/ H7 \! Z r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
7 E% ^/ ]8 ]. {! F if (r == vbCancel) + A7 M5 L/ e& E8 X4 A* K- Y
{
2 V5 f. i& G6 ]4 ?5 D+ _$ i simple.CloseModel(); 0 Z) t( V" B& J9 K
WScript.Quit(); , e: Q9 r, k5 D) \! P
}
- g8 d+ e$ }8 X# O} 5 I& C" h& g! g
; ~: B$ o& @$ O
simple.StartSimulation(".Models.Frame.EventController"); : v( J6 B9 G; ]; }
8 @& t% N1 {, i: N% a
if (simple.IsSimulationRunning())
$ b# W" Q' H) M* y WScript.Echo("Simulation is running!"); ( U+ w2 Z/ u' h
5 p1 W% M6 E( `8 X
// Wait until simulation is finished ; M* h5 }" K, S* z E/ k
while (!Finished) WScript.Sleep(2000); + O. z$ E* b$ f. z8 N
, D; U3 e$ ]+ y3 j( ^8 tsimple.CloseModel(); % Q( m: N" _, c8 V( Z$ o" q) X
simple.Quit(); ' J. e$ U: s% g2 ?* n7 |+ ~) o
WScript.Quit();
' P6 K4 |7 ]+ g" C' f
" K6 J$ H- B. V: e/ ~& w 9 q. b" _+ R0 |3 _5 o
function RemoteControl_SimulationFinished() 5 y/ {+ g3 q$ s) v8 \
{
, @ v* E5 m) L/ R0 K+ y+ w WScript.Echo("Simulation Finished!"); |