Example of a JScript
: m5 M( c( P# g- i; M4 k9 O0 K, |var vbOKCancel = 1; ! H4 @9 w* ^' T" E5 [
var vbCancel = 2;
8 z/ i- V# b& T1 s: yvar vbInformation = 64; Y3 a" I$ x+ }
var Finished=false;
; c* |% d1 [" s+ d5 I& v
: v9 ?8 i3 r. Q% N' Rvar WSHShell = new ActiveXObject("WScript.Shell");
& V% k! {8 \6 o1 q ' p' s- R$ h. h- |/ ~* I
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ( M! t. w/ ~% a; w
; A# ~# `) p3 E3 Z
simple.SetLicenseType("Runtime"); + q3 U. e! \2 B t/ z8 e8 X
6 ]+ Q( f3 }. Z3 z: M, ~
try 0 C! V6 I0 ^. O9 l7 H3 M+ y
{ x" q" u& T9 B: m
// Enter the path to a model file! , e8 N7 m) Z6 g2 J
simple.LoadModel("C:\\Models\\Test.spp");
# {" B) r# x s3 O* i4 o- P}
g! L* L6 U! A% p; U' e5 o7 ycatch (e) " p" Z" o9 W* P2 L/ I$ v/ N" B
{ 7 `. N# n0 A5 X; E7 F& G4 l
WScript.Echo("Could not load Model!");
7 Y) e8 p& B* E7 C( h7 G9 {. ? WScript.Quit();
# x. S9 N! P0 f6 \ ~: {6 b}
& T2 m9 Y. g W4 C
3 s; E3 H8 i2 |) J. v& j& gtry 9 T: L) ~& y$ y; {- s' l6 k
{ . ]7 o( |" N/ |
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
: s& A# \ Z# q2 x1 e- }5 f$ T r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
, Q! s) T0 u2 L. U/ V: ^7 o if (r == vbCancel)
8 H3 G5 I ]1 ~8 n$ v {
' x, \* q: J3 \$ h e" Z1 d simple.CloseModel();
1 K3 n2 f. J2 G& j: Q' v3 P0 C WScript.Quit();
) f8 v h1 U7 C }
; D3 ]) |, v0 x8 X* b" ~" E" V2 S/ B} % a$ w' {5 U. B' J1 U1 g E5 Q
( E+ \# f/ F2 p6 s8 U% s! r1 Xsimple.StartSimulation(".Models.Frame.EventController");
4 L6 z" H' f. A0 D" B 9 J& V+ z: Q, u) X
if (simple.IsSimulationRunning())
& n7 D2 b7 p' m* Z" F. u WScript.Echo("Simulation is running!");
( d; `2 ^/ g$ I6 c+ w
- T: P0 N6 F" G- ]/ J// Wait until simulation is finished
9 @3 j! ^/ b! A" [; _9 E. a9 Gwhile (!Finished) WScript.Sleep(2000); . p& ^3 b x. E/ D9 {
, ^2 d9 [8 q- L7 E' l0 M
simple.CloseModel(); $ s4 `5 A- Y7 f/ _/ i1 C4 L
simple.Quit(); ; j( Z3 x* u& U" M k" k
WScript.Quit();
, U& E' P: r7 h/ s: W+ ?9 [
- C' c* ]$ r+ n& x3 K1 @4 n- ? \ / s8 t6 m# n0 K! b; K
function RemoteControl_SimulationFinished()
! g* y7 b5 T) E5 W. r/ n2 j{ % j( ^ s9 s; U4 Y: Y
WScript.Echo("Simulation Finished!"); |