Example of a JScript
/ Q8 f" v' K, Y. ]var vbOKCancel = 1; ' ]/ U& R9 w% F# n4 ]
var vbCancel = 2;
. O( N" |% o6 t3 xvar vbInformation = 64;
8 S1 W5 d! j+ m0 a4 fvar Finished=false; 7 C& K1 E D4 n; }# p. q
: A8 t& Q8 R9 z2 N- m6 y
var WSHShell = new ActiveXObject("WScript.Shell");
" U$ n$ ~ c6 ` * x4 p# y; g9 v0 \ h3 R; ~$ o' H
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); % ~- ^+ P1 U; p! ^
$ |5 Y6 J% Z1 {+ \. w4 `simple.SetLicenseType("Runtime");
' x0 i' S {$ J% Y+ ?8 L ; o2 `: q- A, X5 [0 J; J9 `
try
8 m6 J5 |) q! W: `{
/ @7 ~' @/ k. ]( W // Enter the path to a model file!
9 B8 H# \2 T' \* U6 @ simple.LoadModel("C:\\Models\\Test.spp"); 6 r1 [; }7 ?! S
}
^; }, V- G8 o; O: q5 H7 Jcatch (e) * O3 B3 x5 V; P
{
- U" \$ c1 w1 }: y! o# Y WScript.Echo("Could not load Model!");
+ s- t5 }* Q; F' _% N0 _# Z WScript.Quit(); " N% o- |. g5 t2 }& K
} 9 m( J7 `! J3 Q; N7 m
0 k' [; g: J7 B1 g Etry 8 l$ v3 t$ r3 k: k& N. r' o* k
{
$ f3 M: N' h8 I* I: q$ N simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
% r5 E4 `) W+ u; \/ X1 f r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); " C5 I2 \% w+ V& g- b( G
if (r == vbCancel) . _1 c, t% `8 l& z5 S- w
{
3 ^7 S0 W1 Z. ?+ c simple.CloseModel();
# [' ?' K6 [7 O8 p& _5 U( i4 | WScript.Quit();
* w5 c, E9 L* k }
& S- V0 ^8 ^5 c O9 j} " i. O0 M) u* x4 m- d# w
6 E5 ~/ Z1 O8 {0 { _9 osimple.StartSimulation(".Models.Frame.EventController"); ( K+ f6 m' R. M; B- N# P4 j
' v1 m+ D1 T. x( @9 o& Qif (simple.IsSimulationRunning())
0 U3 j3 E7 x4 |2 p I! B WScript.Echo("Simulation is running!");
, U9 n1 ~" L7 F( [! W: R8 _4 p0 q
$ n; }" M! f- |# b// Wait until simulation is finished . z; A6 W" N) M! f1 t+ V
while (!Finished) WScript.Sleep(2000);
; K9 F' f( J, G E8 E
4 l) c9 S5 i) t7 H8 tsimple.CloseModel(); ) f, z9 ~0 ^ g9 K8 W
simple.Quit(); P/ y( r9 v; K# D$ t
WScript.Quit(); " W, k0 }. y P9 t7 t4 s- t5 h' c. a
2 K3 t" y5 P6 W, w' X# z$ C* ]4 |0 M
& u% n/ U3 a4 I0 ? Ufunction RemoteControl_SimulationFinished() ) z) y/ z2 t0 `. @0 B- z
{ 0 w: [$ d& d y2 F: Q( a+ _% h
WScript.Echo("Simulation Finished!"); |