Example of a JScript
% l1 ~9 Q" |+ F6 B, mvar vbOKCancel = 1;
, Z1 z) g6 K8 W2 e) lvar vbCancel = 2;
: d7 V: `( U" g& q0 s! [/ hvar vbInformation = 64; 3 E$ o9 t. h0 }: ^5 O: E% S; o- K, y
var Finished=false;
3 v; p0 K) B1 ]( h; L& W 2 q* q* ~/ B7 ]
var WSHShell = new ActiveXObject("WScript.Shell"); 6 ^2 }% W- K. n" x) W& q: J
& B8 R% Y! ?: |' I& v& A2 B( ^var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); . G& L5 [# p& e9 Z8 e* S
; j3 B; k8 U# b9 n, n* l9 x; Q! ?; jsimple.SetLicenseType("Runtime");
+ Y, J9 ~8 e, o/ |4 ]! G: d* W* @ 6 b5 l' P. w* [
try
! J) m/ H/ F5 e3 ?7 g3 ~& g{ $ }! _. O" t0 E
// Enter the path to a model file!
; P) Y, l% G' M/ q2 O+ U simple.LoadModel("C:\\Models\\Test.spp"); " C: ]0 c+ R# y9 m+ N: c
} - A: \& v' e2 e' s. T3 u9 ~
catch (e)
0 @8 }7 Q, A% w$ Z7 a{ * z; u' _% a' H
WScript.Echo("Could not load Model!");
: o8 o8 c8 F; m/ r. R8 a WScript.Quit(); ! c1 Y3 n' ], w* U
}
" v5 f+ s% \$ S. j( r, R! h6 A " e1 E1 }2 j3 o& g
try & l* h1 I: D7 `
{
1 a& o0 S1 \2 a, U/ f0 Z" w/ t simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
, g i# W0 y% M! R. \: q" g r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ! f' H0 B0 i' V! o
if (r == vbCancel) % X7 e6 Y& o' O; D5 T! r" P6 x
{
6 Z; X6 \3 V, k6 T! F) } simple.CloseModel();
7 g1 ^4 @! M- _( |, b WScript.Quit(); ' M* s6 F [- O+ i6 L: m8 i. V3 O
}
6 p& } d3 B& }/ h} - @7 K) ]" s+ R( ~) m4 i
9 r. n3 ~8 E# Y: C* ~& L; psimple.StartSimulation(".Models.Frame.EventController"); 3 z' u2 P. r2 t& I/ T% b+ V
$ N5 F+ P& ~, M) n( k" [
if (simple.IsSimulationRunning())
& ~# j$ W! U, S; [! o" S) e. A H WScript.Echo("Simulation is running!"); / R" t8 h! S# Q* m, C
5 }' p+ K Q3 D
// Wait until simulation is finished 6 `9 @1 d' { d0 W/ H, |6 X; B
while (!Finished) WScript.Sleep(2000); 0 N% f; H% N. y: N' ~( A" ?# E
7 v& [3 S$ A+ g7 E$ _simple.CloseModel();
0 \, Q' f$ P/ _8 ]( q- @' U# [2 jsimple.Quit();
1 ]0 G; [. l; `- y# L/ E8 |WScript.Quit(); % Z }* l+ C; o9 ]9 Y% L0 i( P# c
& [) x" Z o, y; T
$ j/ u$ j$ ?! F9 bfunction RemoteControl_SimulationFinished() 6 k8 K4 B1 O- F$ @4 }
{ , y8 T0 U/ _+ Z' \3 O
WScript.Echo("Simulation Finished!"); |