Example of a JScript
: f9 a6 p4 p) ^- M N0 [, pvar vbOKCancel = 1; i: W; T4 c* K2 q @# i
var vbCancel = 2;
9 s) ]+ }. ?: Q8 {7 k# Svar vbInformation = 64; % b% j; M* E$ t% ^, S# R
var Finished=false; + _7 ~& c0 M: h
) t) T7 c: f( P! E) W
var WSHShell = new ActiveXObject("WScript.Shell"); 4 P* a4 o7 R8 N: c
2 A/ F ?2 `! f3 s1 zvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; w: P Z( q8 ~* d% A
! u2 n) y3 H2 ?. |) isimple.SetLicenseType("Runtime");
, T$ k# ]- g3 C B# g: ]+ T& v% \1 J
try
+ C( R3 F9 K: i; j{ ; h: l! d" I9 I8 N$ K, X" F/ J
// Enter the path to a model file! 3 j! S% ]5 r# m
simple.LoadModel("C:\\Models\\Test.spp");
& z7 q3 ?& J! |} ( _* _: {5 [5 s( r a* }* @. M
catch (e)
7 \+ L- l; j6 [: J3 J{ : |5 E. U4 Z9 \% h& I
WScript.Echo("Could not load Model!"); ) h6 [. |# A+ D
WScript.Quit();
) i0 Y: B1 C$ @ ]. u7 F8 A2 n}
; \( P4 I' R! `: _0 @
( Y; [* T# O8 |, J5 `& v, ztry
0 C$ l' I: ~# W9 ^6 Z{
' O7 G! P5 u9 _1 G. q simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
, F8 Z6 I7 n# g5 h( F, {! l( j( O r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & A3 h9 N3 R8 t$ I8 {# \
if (r == vbCancel)
. c4 [. s' P1 H' d# G2 a0 k {
9 V: r0 s' f! w/ s simple.CloseModel(); % Q) a) Y, W2 }: {6 @2 j/ \
WScript.Quit(); # ]8 }4 ~3 f6 k- }7 C# Z
} ; M: t) n. W" Y" c1 g- q4 c
} ' H- q* A3 H# X$ q
% S- `' o- f4 O5 f" X4 a
simple.StartSimulation(".Models.Frame.EventController");
& P7 V+ ?) r0 G3 p
& `% z+ l; Z Z. D9 e% g, n8 P' pif (simple.IsSimulationRunning())
# |$ v) ?# h2 D& k* Q WScript.Echo("Simulation is running!");
% N7 c* o5 O5 H, O6 }5 J9 M3 g# Y; V
& c$ f# Z! M5 a u// Wait until simulation is finished
+ G1 d% F% |& y. J G$ D! I1 dwhile (!Finished) WScript.Sleep(2000); ! i# ~2 D/ g7 S8 A" p
, U6 x8 x5 \ ^6 w6 x
simple.CloseModel();
2 [! H* l4 I7 B2 {5 Rsimple.Quit();
/ C5 y2 ?" h7 ?( @$ x' p9 Z* ~WScript.Quit(); ) s% Z* p1 C, ]" h1 K9 [
8 g! [6 y/ ^1 Y* I
. C! H1 x/ U, s& y" g9 s( o0 ~0 X
function RemoteControl_SimulationFinished()
& b x6 y8 k+ e/ U$ M! ], G$ q" ]{
1 o7 s" ?6 @2 r% t3 o8 K6 v WScript.Echo("Simulation Finished!"); |