Example of a JScript ! j0 d: r' U' q1 c
var vbOKCancel = 1;
; c+ g D- k1 M* L# F' g3 Q: m( T4 P# Cvar vbCancel = 2; 7 w* K! t# m4 q
var vbInformation = 64;
U$ o6 z$ v" {) K* E- N/ [var Finished=false; 0 z8 B; z- K1 ]
9 W. U {# \+ w3 T0 rvar WSHShell = new ActiveXObject("WScript.Shell");
3 D9 p2 Q6 y7 a
, [$ A, v: }. S& [( y2 a: c' P2 _6 \var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
' ^: w4 h) L2 z - W* n3 ?# a2 S0 X5 H# H8 w
simple.SetLicenseType("Runtime"); 7 L) r' O8 K8 I8 O& |1 X
7 C ^& ] C& e) c- ^; M9 ^! E
try
3 _6 A0 k+ r; n/ K8 @) u. i2 ~4 J+ S{ # |; ]8 l4 E3 K" t( g
// Enter the path to a model file! & Y' Z8 b5 ?2 H+ _# q6 J6 H
simple.LoadModel("C:\\Models\\Test.spp");
0 R: K0 Z2 P+ l}
" H% v, Q6 \( Wcatch (e) ) c! [- W& F' B4 m h. p
{ 0 ~$ }" L5 C# {) k6 V2 Y/ d
WScript.Echo("Could not load Model!");
6 V! u; U) Y/ o WScript.Quit(); + q- C: g6 V! }2 Y- F
} & Z, z! a& F( K
+ x& m+ n! a( I" D9 u
try
4 [! P, h) c4 u4 a: h{ - [ l; L9 l: k4 J
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 8 x. X7 H8 y8 j T' o) C
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
& ~$ n( D1 v, t: l+ x if (r == vbCancel) ' S7 i; L- W4 D7 g
{
7 [9 Y! D% ~5 h: {: x/ T simple.CloseModel();
" f k- |6 _4 {1 K( g$ B$ _ WScript.Quit(); + J* Z- s# O) U4 i* f
}
: \" s9 e; J, {9 Z) R5 Q* ^" h}
+ d/ R* B* Q& @8 d
2 ~2 A. o. p' y. ^simple.StartSimulation(".Models.Frame.EventController"); % u: M x. \6 p- m/ K9 Y
; a. o0 c# j% L$ z8 X: _8 T
if (simple.IsSimulationRunning())
8 y8 ]# d; i5 T! l! e+ { M( i WScript.Echo("Simulation is running!"); 7 ^, c7 _3 y. d3 U
; ]2 T+ v6 A8 W% g0 G4 t// Wait until simulation is finished + j/ w8 ~, [2 `: R. n6 Z
while (!Finished) WScript.Sleep(2000); # J+ [( R4 B: |, I7 ?
! D" t, H& M# q0 q" E
simple.CloseModel();
' u7 z" |( W; H; \, C& i" x8 Csimple.Quit();
- C2 Z- H! {; H) f/ H" c+ UWScript.Quit(); / N1 J" y/ e! |7 \+ k- y% K
5 C9 K. Z# p( T& C$ C" L5 q. K& r1 p
3 G5 U9 c3 H- w& @' j9 t1 Rfunction RemoteControl_SimulationFinished() * u' X, G0 {$ b+ `, y
{ ' j) x# z+ i; O2 E M0 g- w; |2 O
WScript.Echo("Simulation Finished!"); |