Example of a JScript ) `9 [5 _2 p* {7 W
var vbOKCancel = 1;
6 Z/ R6 l/ V+ F* X6 @- V; \( y# xvar vbCancel = 2; , Q. O. C. D, w9 g& A B
var vbInformation = 64;
. A5 H' {9 i' D1 Q$ Tvar Finished=false;
v3 m0 l3 y/ n$ A" V) @$ a " u5 Q# T# K/ W, l; L
var WSHShell = new ActiveXObject("WScript.Shell"); ' _- x; v, Q6 O) |# Z3 e4 t
& m* P& l4 I# B, ?
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 5 U1 E- @: B) w4 B7 i4 p c5 E
0 |4 W. E- X, G
simple.SetLicenseType("Runtime"); 0 Q, Z2 y3 M5 u0 R9 t( @. `
3 r3 M$ N+ S, |3 c) q7 [
try / O! [0 P( A% {. c
{ : K% r. ^+ _- }0 h7 w4 t# f' M0 [
// Enter the path to a model file! 8 O$ J3 C* o/ r; S
simple.LoadModel("C:\\Models\\Test.spp");
$ x+ ?. G/ j. r/ T- J: |}
$ J5 q7 y/ P: D. W$ n' n! Kcatch (e) 9 _1 a. |1 V* D, g
{
4 Y0 j: V/ e: g4 \5 r4 } WScript.Echo("Could not load Model!");
. F; [' M( ], y& D) W" G WScript.Quit(); " c. Z( R# L9 `$ Q/ u
}
* ~! B* C% g$ U5 a/ b
! O7 ?- G2 C \6 l; ytry
7 E; s4 j$ p9 c- \4 O{
( `3 X4 \1 B& ?. R simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 6 H+ j. b! u0 `$ m# R2 l& {) N
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
8 w% C. Z4 V# p* i+ d if (r == vbCancel)
5 Y% `0 Q) n* @1 X8 R {
$ O9 A% Z2 K9 q simple.CloseModel();
& y$ V5 l8 {: ~ F& l WScript.Quit(); % `6 X" K% O2 |; _
}
, P% I: l/ M5 u H t- x} : X4 t5 W- h8 ~
9 z; o: \4 l* T1 }# }8 g
simple.StartSimulation(".Models.Frame.EventController"); 0 l; |6 \7 T+ m5 {' ~
6 d& c% b |4 W. c: l* ?) rif (simple.IsSimulationRunning()) 6 ^- z7 x- F$ ?2 H# o& b$ U4 m- F
WScript.Echo("Simulation is running!");
/ R+ u* T, O l2 X$ z }
# n' @! }1 A2 T* S& E) H! z8 K7 W5 J// Wait until simulation is finished
, d$ l# _5 }& H- `2 }* Twhile (!Finished) WScript.Sleep(2000);
- k$ T' a9 I- c( M2 a) j3 b
! q' L+ A* t5 _. }3 D6 x9 r5 S8 C& Tsimple.CloseModel(); ( f: b3 ]. F% r3 }+ N1 |. |# _
simple.Quit(); , ?8 S/ G7 c4 W A# l( G( ?2 J
WScript.Quit();
) v! f! v4 c; G/ Q " |6 v3 K6 K: @# H6 U
2 K9 x& _9 s* U& |' w
function RemoteControl_SimulationFinished()
5 z' |, \- J! H( |: i0 |# H& x{ - j, T# l9 W' d1 o5 b" G
WScript.Echo("Simulation Finished!"); |