Example of a JScript - z0 x) X* n6 Z i" s
var vbOKCancel = 1;
3 P I0 O& f3 h5 r# gvar vbCancel = 2;
- _* w9 ~* Y! Tvar vbInformation = 64;
. l5 v# b( F. }1 h1 j/ R* Mvar Finished=false;
! B: Z4 a/ b( U# s* b8 z
) {6 I ?4 M' l$ [var WSHShell = new ActiveXObject("WScript.Shell");
! A! p, X. n& G# m' W' a; { : t3 ]; Q8 }) _2 K8 O5 u
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * w7 v9 n' G/ |8 o- E% S% ^) p
7 Z; S0 O, I3 R% @simple.SetLicenseType("Runtime");
$ _2 v5 F& F* @
# s3 [# z3 \8 v+ E% N8 r5 Btry $ E9 e- {8 i& @& @3 l3 F5 M7 ]8 t6 a
{
- {) _0 H) J ?2 Y% T( Z // Enter the path to a model file! 9 |* P u( x+ a" Q
simple.LoadModel("C:\\Models\\Test.spp");
B$ \) R9 [# P$ \4 Z* C. R7 E/ [}
3 p* j" E- `" u {+ Ccatch (e) 7 c% X1 _8 }' d+ M" m, c
{
% \0 `- _5 R" ?/ r1 W WScript.Echo("Could not load Model!"); ) R2 ~0 y; C# h5 x- g' z; G
WScript.Quit(); 9 i% g/ Z% \9 R% m; N
} 6 D' D% b! V" q6 E( i, I
& V$ T7 q$ s q! Wtry
$ D4 w8 n& V2 L* f8 D{ , @5 O0 n: A# }# x; L
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
; ~$ `9 c% q9 K c r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); * {5 h& q5 {3 S: O
if (r == vbCancel) / l: b6 W3 p T, S6 n/ ~
{
; P! F5 g% y: v simple.CloseModel(); 3 q0 L. M* }- E6 e/ J
WScript.Quit(); ) t1 n' E |" g# @4 k9 P- |/ ~
}
. @/ B! p% A' H1 z; M4 D} / f* h: @. B' K, y% A9 k
% x; E2 e: V7 ysimple.StartSimulation(".Models.Frame.EventController"); 5 p; I r) H! Z5 i/ B, j7 G
5 S- ]) Y% t0 O9 y0 z: V/ Wif (simple.IsSimulationRunning())
" i# B) x& H. {7 Z WScript.Echo("Simulation is running!"); ; x& k, q; ]( z. e3 O
k) X4 q' y7 \3 {// Wait until simulation is finished
) }* p! G/ x4 e$ @3 kwhile (!Finished) WScript.Sleep(2000); " U( _0 z% |: y+ j
- K" L+ V% u( o4 {* R* n" e
simple.CloseModel(); # r# Z! w* P) ]# m7 S: [& L s
simple.Quit(); + {; Y: O: J5 i2 b; o w
WScript.Quit(); , t7 \, `. `) W/ u% u. G# _
0 I/ P4 o$ O2 i& `
' ^2 x8 U5 e. O5 c% d! zfunction RemoteControl_SimulationFinished() $ n6 {3 ^, G4 c8 w p1 |. g. }
{ 0 M4 `9 g- j+ A! |- U* i$ \
WScript.Echo("Simulation Finished!"); |