Example of a JScript
2 d s" x0 a) c. }) c. nvar vbOKCancel = 1; & p+ m. y6 r! f1 x% ?6 @
var vbCancel = 2; * f, v8 i/ O4 c* f, q7 w
var vbInformation = 64; - `* a/ S6 ]0 j
var Finished=false;
4 ] V' ^3 W* j$ \/ m6 |; J H, | 2 G# b6 x8 v8 x: ~7 F
var WSHShell = new ActiveXObject("WScript.Shell"); & B$ I& f* f9 M9 n! Z8 C! f/ E
/ @6 S' J/ p3 `& x: [
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
y) R8 P& i( D1 F. E( ^. t ' ]& |0 k4 ]& R' B5 b% B
simple.SetLicenseType("Runtime");
6 W: J9 A+ A8 |& p: ]" M: y 2 }. e: [7 P. M& S. V" p
try
1 ^/ B: `( x1 ?, G{ 9 R7 K8 D. y$ }7 f) Q) Y, ~
// Enter the path to a model file! ' o5 P+ o, A( A2 Y
simple.LoadModel("C:\\Models\\Test.spp");
6 z U: S8 P2 s8 i: p- t+ E" t- W! x} 9 |8 E* ]( m2 P6 K4 U
catch (e) $ Y! W' T9 r0 Y
{
) L8 h# x P! C1 }7 D WScript.Echo("Could not load Model!");
' I7 F- g! ^% i' S/ `" t! p- n WScript.Quit(); . ]) _4 j' D* c# ~7 f
} " \( x, R- v# v \' t1 v: h
4 _/ |& O* ?3 S, t
try 2 Z! h( A+ ]6 Q) N5 o x
{
; S9 _) r3 c# V) a2 q7 r/ a simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
$ |" q0 S V( q0 z% x! q. i( T r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); - X% U) e2 {% V7 d! a% J( g
if (r == vbCancel)
) i" ^" ^5 Q" h6 O4 d5 ?0 ^+ I { 9 v( }2 u t+ I) z2 k1 }0 ^! O# N
simple.CloseModel();
* }3 E6 x/ P9 ?5 A1 B# R4 e WScript.Quit();
5 O$ o2 {! S L- ~ } * [# @+ L& o0 W/ ?
}
8 u2 ]. \# i3 M) S- l1 O* a/ }3 w
8 w" y" U+ u9 k, j$ g% n7 k$ i, ]simple.StartSimulation(".Models.Frame.EventController");
) j m, D( N1 N% [* Q: z* q* S 2 g7 e4 x) \6 d4 _# x+ f
if (simple.IsSimulationRunning())
3 b* V. q' S, n V! K* C+ n WScript.Echo("Simulation is running!"); ) @* w& v& `5 f* H9 u# }
5 Z' d- J# A4 Q. m8 z. R// Wait until simulation is finished
& _6 ^* k: i) k ^. fwhile (!Finished) WScript.Sleep(2000);
6 f0 b* H* C/ g/ A3 o1 A! c
! ]0 I+ O: z8 Z' R* a, F" w3 {! Psimple.CloseModel();
( |! h1 [% x, C; D7 }7 ]" ssimple.Quit();
! O$ b% k- t. M5 yWScript.Quit();
- I0 k0 ^, g4 ^5 r" e. `* l2 ] 0 v2 \; |' O8 Y
/ C" a |& b7 m* Z/ A7 m/ I
function RemoteControl_SimulationFinished()
" `- A# ]7 V& @$ Y- Q ]{ * [# l0 g \4 `& U* k' K* {
WScript.Echo("Simulation Finished!"); |