Example of a JScript ) [, ?3 G. `$ T4 O; {
var vbOKCancel = 1; 3 j v8 B {8 o2 x# M- f, b
var vbCancel = 2;
. U# b9 }/ S v5 H3 y5 z( _var vbInformation = 64; $ f C3 e0 `5 c% L3 O g* p1 C
var Finished=false;
# [. J8 W$ S9 m* {- K
1 e4 y1 z) U7 ]6 Y; v) Q7 {/ cvar WSHShell = new ActiveXObject("WScript.Shell");
, N! V0 T/ Q7 M % W8 n, [! d8 X, c3 p3 z6 O
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
@: Y% i) ]+ L: ^9 B1 J# B / A# |9 D- ?. X) `, U/ F5 n
simple.SetLicenseType("Runtime");
/ a3 L1 ?$ l$ n! @% ?/ x
) w3 e* S0 f% |try
2 g6 y" o1 U. Z7 x" h/ k{ ' r1 k& c6 z0 f6 l
// Enter the path to a model file! ( t# s2 j( H. C. B: `
simple.LoadModel("C:\\Models\\Test.spp");
( v% b% R* ?: ?1 h6 _7 G, U$ F8 h}
6 A) E* M) C+ scatch (e) ' n6 f8 l) c; }6 d" D
{
( [# `" _" g: K# h1 Z WScript.Echo("Could not load Model!"); , X4 O- F( B/ T9 O
WScript.Quit(); ( N' M/ b( Q6 J |/ T* g
}
! r0 _1 @1 a7 ^0 I( B
5 n/ d8 c4 l+ `6 }. ?try " p( x; G) m+ q2 M7 G9 l$ ]' f3 D8 i
{ ; Y3 _6 ], M$ Y h: y& m
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { * D' T# Z0 M* \; s9 Z
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); " M5 o, ~8 ?8 ]8 `/ y8 o
if (r == vbCancel) 4 [8 ~" I2 j3 e9 z& J1 l% c- R7 a
{
" h( ?$ Y5 G# y8 C$ L" Z% j simple.CloseModel();
' D7 F0 ?1 B- [7 l WScript.Quit();
3 {) P, w' O' L3 I7 a+ e: Q } 8 @. \9 r9 I; ?
} , W& T3 ]# H' e: L6 Q
; m A" n, ?0 ], c' E2 hsimple.StartSimulation(".Models.Frame.EventController");
+ K5 U, Y9 Z3 e1 n% y+ E' j1 n
3 z1 ]* f( }5 r; oif (simple.IsSimulationRunning())
( u4 X+ G' D! A: n6 i# P5 _ WScript.Echo("Simulation is running!");
/ D+ j3 o! I+ _2 k" f. ^+ ~# [5 D 8 K0 P) b: s$ _
// Wait until simulation is finished 8 q5 j# P L6 M! _4 S
while (!Finished) WScript.Sleep(2000);
$ L* P, @$ c$ C! Q0 \$ Y! l
' z0 |& `7 O3 x: c. h s: zsimple.CloseModel();
$ C- C/ `7 _* P3 }+ V( |simple.Quit();
/ I& h2 Q/ T5 T$ x$ f8 }- N2 AWScript.Quit();
3 \3 }) x% P& j3 D' g6 _5 C' A, A
- G/ e- `: C0 `* C. C9 t, x0 b % \3 |0 s5 G% `
function RemoteControl_SimulationFinished()
# I- v1 v; r! c; Z/ C. u2 q2 |{
0 L) ?7 t9 c1 j9 n) |% c$ a WScript.Echo("Simulation Finished!"); |