Example of a JScript
; A/ F$ e2 G/ V* e7 C& D- M) mvar vbOKCancel = 1;
: z2 t' r4 g6 H* vvar vbCancel = 2; : d: T7 p; A7 @8 s+ h: X
var vbInformation = 64;
1 e" V; N0 u2 |; Wvar Finished=false; & f, c, x6 {, e
# T2 J% L0 m- n5 M* B q3 v
var WSHShell = new ActiveXObject("WScript.Shell"); 5 ]5 U, N/ F- X6 K/ g$ P1 H
9 w0 o& Y' J8 K1 d; C
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
. g9 j4 x& x! w. A8 ~" u * t B' |- G2 [' Y& B
simple.SetLicenseType("Runtime");
9 V4 g: Q3 j6 R( K ]
. g! Z" b: [& \; T# B# [) v) Mtry + a0 N2 \$ b1 h! q: V
{
# ?1 ?7 ^4 a* n1 ~( y1 Y // Enter the path to a model file!
/ ?- Z `5 z8 O J% o3 g- U4 i, u simple.LoadModel("C:\\Models\\Test.spp");
) c k( I% B+ U9 H9 Z% r# ^}
# \# f. F2 A3 ^7 U: Rcatch (e)
# A% {- T' J' X# k. p4 k{ # s0 z5 ^- j0 y4 g* C( N
WScript.Echo("Could not load Model!");
4 r: ~( U4 A& j! i# ` WScript.Quit();
# q0 n- l1 b' o& m& V} / J( d$ V2 i0 ~' ]; I& g
7 ]( \7 D9 w7 v% Y, ?9 I7 x( P& E
try
. ]0 T- @ w2 X: A; x1 N6 s{
" J5 C; j/ E0 p+ i: @* v simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
, O, @2 ]" p" @9 ]2 }( o r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); # [% z5 z0 K6 Q5 }
if (r == vbCancel) 2 t9 H L; {# R0 C! }
{ / U5 b3 K3 {$ U# ]" ~: \$ \9 D
simple.CloseModel();
; r4 |5 v% n* f3 }( N+ F7 H& ?% J WScript.Quit(); + a7 T* @: a, I0 s+ L
} $ I8 ] |/ `0 r7 r' v
} ; z! f# Z+ w: [
/ A) A( h0 j# R4 T msimple.StartSimulation(".Models.Frame.EventController");
" r3 `' F; b9 k' R
, j, d( }- U. f+ P2 b" Q3 iif (simple.IsSimulationRunning())
6 ~) K, s3 o) N2 f, `8 O- y1 \ WScript.Echo("Simulation is running!");
# N$ ?( p9 d h$ ?' U6 `" c & E* g) o" ^8 G' `
// Wait until simulation is finished
3 d7 A7 C2 m2 a: {5 Wwhile (!Finished) WScript.Sleep(2000);
- ~4 t- f# K# P$ a+ L . q9 x* c6 g2 z2 |
simple.CloseModel(); 0 |+ `& T! u0 S v0 {$ n
simple.Quit(); 1 H' C6 s& T% p1 \) ?
WScript.Quit(); ; y6 [5 `+ S6 a# Q+ y
* g( O# \* O8 i" }6 C/ u n 9 Y+ q9 M3 t; b; H9 @" R N
function RemoteControl_SimulationFinished()
3 l1 Y, @! l9 u1 }{ , ^1 l& \+ p7 t \. s
WScript.Echo("Simulation Finished!"); |