Example of a JScript / k Q7 U+ |. u+ C# Q" ]" ^
var vbOKCancel = 1;
6 j$ B" u0 Y) B1 w+ kvar vbCancel = 2; : S" z1 z* K$ i* x% h. ? I
var vbInformation = 64;
& e& N( L) m' T/ _var Finished=false; * U5 Q, |7 t1 O q
* N% |( U. y& `, F) H% L
var WSHShell = new ActiveXObject("WScript.Shell"); ! H' w0 \3 e& y3 T l) h3 N$ X
8 N" Q4 u0 s9 @1 @
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
# B) ?% B4 @( Z9 s 5 j5 j: K9 j9 y1 L- a; K: S
simple.SetLicenseType("Runtime");
2 R8 @# V" k( s
: `+ R; w) i/ W2 n8 F+ E8 Gtry
; Z4 ? _9 `% h$ a& t$ B{ ; K: i9 O" `" i7 w- T; x
// Enter the path to a model file!
u( f/ t( d$ j# D3 X$ @! Z simple.LoadModel("C:\\Models\\Test.spp"); & y' \+ N- {$ e% y6 k9 ^
}
* N5 V/ |' z/ ~ acatch (e) ' }" G. e6 o y0 y
{
7 b- x* }& ?6 T8 i WScript.Echo("Could not load Model!");
" D% z# q- g& D" v9 G, r WScript.Quit(); 5 M, J" {3 E3 ]" ~* ?% v& I
}
1 q9 F2 U8 G# T/ e1 w, F0 E
- a$ _: J" }6 q: N4 s! z0 Ytry
0 J7 W, i* M9 Z! l3 ?{ & R0 i) r% g, a# N8 c
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 0 H7 W( d' I& g! H; I- J1 f
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & p* H- v8 `6 T$ _3 l, `9 E
if (r == vbCancel) $ `9 I2 ^6 a$ X" A; E
{
' r$ y! t9 U; v* x simple.CloseModel();
7 F* z0 w6 {+ T/ P2 ^& m WScript.Quit();
5 K: S3 J8 s7 H, l }
- S. O5 t* V1 _. \- d- A} & K4 \9 ?0 V0 [6 k, i$ u, j9 `( e
3 ?; @+ b: k! U- g8 r' q1 K% [
simple.StartSimulation(".Models.Frame.EventController");
M R! r: u6 C) ?+ e & ^0 k. V9 I1 T) u" U1 C
if (simple.IsSimulationRunning())
# a! A! ~6 p) V2 d" C h/ o% I6 W WScript.Echo("Simulation is running!");
9 N- j! j/ f% b' y
1 e% F) E8 ? c+ d// Wait until simulation is finished % D( Q2 H4 n1 T. R" o
while (!Finished) WScript.Sleep(2000);
3 b& l: g: a6 V. m) a2 c
9 v: P3 A5 g' Usimple.CloseModel();
9 R+ g# D$ O9 N0 l# }simple.Quit(); 3 O. {2 d: i @0 L
WScript.Quit(); 6 S4 x4 D, q9 b5 y2 F9 U3 {" Y+ W E
" d" G' H$ v! G& g9 J. V& S8 {4 j
& P3 s; M; D& y0 Z# ~8 V
function RemoteControl_SimulationFinished()
9 a' G4 C- N% G6 n: a{ 7 V: \% J6 O6 K7 W1 X- |5 X8 e0 c9 H
WScript.Echo("Simulation Finished!"); |