Example of a JScript
) I' z( r5 i5 l8 t l: tvar vbOKCancel = 1;
3 U' [2 F/ X" i2 _* H' h% Fvar vbCancel = 2;
# T9 L" q4 S- ^ q$ T: u/ svar vbInformation = 64;
5 w4 e$ R' F, |" pvar Finished=false;
+ K9 O1 e" g( L+ F* C
1 [" \. z* G6 g0 k+ N1 \$ Dvar WSHShell = new ActiveXObject("WScript.Shell");
8 @. q2 `5 S* q8 b# Y; o + |% X. B& W" S. ]! U
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
7 C* }# H& f! I0 k# ^+ E5 e 8 I. R3 H" |& \$ e7 S! S$ g0 x
simple.SetLicenseType("Runtime");
. ^+ Q d; `, R- G: h1 x& e 2 C# H* C4 {, c n ~
try
- e: }( h5 q g2 u0 Q; y1 [{ & Z( b1 l/ @& c# U: p3 i! x* r! x
// Enter the path to a model file! " x+ l* A! R! `
simple.LoadModel("C:\\Models\\Test.spp");
: W2 |/ r' I9 ?+ ^$ K} / q7 Y& V, A! u! p3 g
catch (e)
1 c5 r7 _. K7 A4 Q. o, O3 `{ R$ r* X- ]3 b) ?
WScript.Echo("Could not load Model!");
: X+ z2 X; e% l. L1 R WScript.Quit();
: r8 |( `% K: T$ n}
/ p' Z3 P6 A1 v4 a
$ o' O3 b2 Y% D# F9 ]0 v! Ttry
/ M: D6 @. c" k: b2 @- {- F2 z) [{ : \, h! q, ^ j6 D% u8 X
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { - V' f; U! ~7 V+ w+ l0 _
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); a# P0 J& K% V0 `
if (r == vbCancel) . {8 A4 G+ k4 e, T( ]1 R
{
8 u) F* z+ K; P! [- B# \ simple.CloseModel(); 2 y+ u& N0 Q0 i, C! O
WScript.Quit();
4 `6 J$ e' ?4 Z }
4 f' V3 |$ V- R$ U}
$ K2 A& P; E2 ~# v3 s' @. o
j% w5 ~. ]9 K4 o R. csimple.StartSimulation(".Models.Frame.EventController");
% f: P. X+ W2 [1 H
" w- D1 Z! s" [* C2 c3 r$ uif (simple.IsSimulationRunning()) 7 X5 v* |1 k7 a F; f6 t z e, y
WScript.Echo("Simulation is running!");
! d7 ~' J' L$ Y: G1 d4 C d0 u% m- g* Q 3 G3 C# Z7 M) N1 h% C4 E( @
// Wait until simulation is finished
# D. q% l e0 J V: @& S2 V \while (!Finished) WScript.Sleep(2000); & H7 O1 Q7 _0 U5 g1 o; X" V
% {& U! w+ g. {* {
simple.CloseModel(); 5 h8 p' L! `5 e/ \& m0 Q
simple.Quit();
* N& X4 V; ]; P5 xWScript.Quit(); ' O+ o: C6 f0 e3 Z
2 H+ e3 y* L1 x$ ?/ o3 \ 3 C' e& Y/ U. t2 J: D3 s( b: l1 E
function RemoteControl_SimulationFinished()
9 T/ C, l# d" s8 D" n{
1 v% u0 }! ~. g6 Y WScript.Echo("Simulation Finished!"); |