Example of a JScript # I- j5 N1 _$ [" K0 ^- B
var vbOKCancel = 1; & @4 G4 m6 y( W) j1 `- S
var vbCancel = 2;
?$ }3 t) _4 f, tvar vbInformation = 64; & Z! n+ s/ @' i: Q" Y- V5 D
var Finished=false;
4 R6 @8 i; n" U( b * A: o* R5 [# b9 ^2 O2 F5 t8 h
var WSHShell = new ActiveXObject("WScript.Shell"); 0 s5 y R# j3 E8 [. }7 s: N! |$ P2 Y
; {" B3 Y% e4 l) R% e. A
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 7 q0 i/ p2 y! O- v- Z0 d' F f
: s7 q1 @( Z& T$ v8 M( j' l9 D& a- Ksimple.SetLicenseType("Runtime"); 1 ^; S: j+ ?7 I+ o0 P% X# [
' S R! L4 G# A2 g1 g& X H, Q4 } ptry 7 I$ z- N# P: M$ Z1 U
{
" U1 b, n* K8 G" s2 W/ a" s- ` // Enter the path to a model file!
, c2 \7 q( ?0 f simple.LoadModel("C:\\Models\\Test.spp");
. @1 N- V V" s} % Z4 f, O0 F* M! @2 v4 M
catch (e)
; d j: h) q1 Y9 Q. s, e{
5 J6 w2 a; j" S3 X0 W WScript.Echo("Could not load Model!"); ) t8 \3 m. n x5 T$ r N9 p$ ~, f
WScript.Quit(); k. s3 ?$ L5 m) B. h: W
}
, X) |$ {) }! ]8 S) G; Q - j Q* [5 ]" S$ Q1 P0 o0 ~# T
try ( u# l/ O K) r3 C
{ / M; w" Z6 B" U4 O& Q
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
P( Z$ y% e% s+ Q r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
+ }& [5 U( _% p if (r == vbCancel) ' K. f' ^9 N# X3 k1 Y
{
3 W7 A- s3 X% \. s! e9 \ simple.CloseModel(); 3 w( w8 ~/ ~9 C5 t0 |
WScript.Quit(); 8 x J$ s, B' x% s, R
} / Q# B- R& G; D% p
}
% s. Z2 A- w' `+ N
3 B1 b4 ?8 O$ t; |6 g% X2 isimple.StartSimulation(".Models.Frame.EventController"); % L7 V$ ~$ C2 Y3 Q( H
- j* Q2 j0 p2 b; b; x9 ]if (simple.IsSimulationRunning()) & O6 ]3 A, n7 h/ f% |% L/ P
WScript.Echo("Simulation is running!"); 1 y$ s( F% V- h- ]9 {- @& Z, D
: Y% e: }, K8 A. d
// Wait until simulation is finished $ @- V; d5 z8 Y; T3 @* `
while (!Finished) WScript.Sleep(2000); % V" }9 w! l/ Q: i8 e- y
- m) l- v) v0 [ e0 M; q8 c/ gsimple.CloseModel(); 2 Q( h2 _9 s/ z! y. t4 C
simple.Quit();
# H% W7 ?1 [* T; V8 b( \WScript.Quit(); 9 i5 l9 A- y6 e5 A, K. L A
C( X4 U* V- v* H 9 A" K, K; l, a; z, S7 Z5 m
function RemoteControl_SimulationFinished()
' `7 C' f P7 f, q; n3 f7 C! P. d{
0 V5 g# {5 Z$ [; Q: n% V! g7 q WScript.Echo("Simulation Finished!"); |