Example of a JScript ) l% C# J( G3 U
var vbOKCancel = 1;
~/ s' g! J. @" X3 l3 gvar vbCancel = 2;
# o5 n5 Z/ L( K% V! G$ cvar vbInformation = 64;
) M; w9 }5 G5 W6 Y0 e8 T# Wvar Finished=false;
8 T; [/ |8 @* f E7 F5 [ o) B
, X* I4 { |5 t2 O# evar WSHShell = new ActiveXObject("WScript.Shell");
- Y6 m/ \$ R: } 6 w! N d% r# W; [, S
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 3 i5 F) l& t7 b5 o/ w: U( b$ Z* S
# s% s9 I$ } ^simple.SetLicenseType("Runtime");
3 _3 J) [; e' F$ q9 R; d $ U0 ^" j& E. w# J
try
- p# L$ \+ z$ r2 Z' j( T" I/ L{
h/ }1 ?) p0 p$ u! d // Enter the path to a model file!
, s; D! z" W0 w1 ~5 i simple.LoadModel("C:\\Models\\Test.spp");
" [& ?* l# n \( _% X} ) s; t3 t, I! M0 ] s& V
catch (e)
% i$ [" E, C* `1 Z3 C/ H2 {; D{
, R- C) \; o9 J; g: W$ V( Z WScript.Echo("Could not load Model!"); , F; i/ M0 q' |, y" G1 ^
WScript.Quit();
( g- D2 J+ Q X" c( C$ h: u0 R}
. t. v4 x$ [& |9 U" ?/ K
1 g t8 @8 ^7 V0 s* i& stry ( ^: i& A+ H2 D% w
{
% l6 G& z# ]3 I; v8 i, Z simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
4 H. B, c$ \% ^' ? r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); / Q+ \, ^/ o0 X- v Z
if (r == vbCancel)
( T+ x k! }: Y w* d# F9 c { + f- P# t1 x" W' {* N
simple.CloseModel();
# g* E* b2 H4 e+ T* s4 N WScript.Quit(); % @6 N& E# u5 `# e; }# G/ }
}
6 ]+ i, }" g0 v8 G}
9 l- Z" ?: F& B# L* ~1 C+ R
1 k7 A1 `. {7 m! E/ g7 Nsimple.StartSimulation(".Models.Frame.EventController"); 7 l7 P5 [5 |; w2 h: W8 e* N
1 k3 \/ _' h) f! w4 M0 ?
if (simple.IsSimulationRunning()) $ S. w3 X( V4 g, Q, T {4 C9 s
WScript.Echo("Simulation is running!");
8 [5 _" M4 l9 h2 I" f8 \9 Q 8 S! R4 I3 p7 C
// Wait until simulation is finished 5 h5 o- T, Z! H$ o: W: p# F8 F
while (!Finished) WScript.Sleep(2000);
: @0 V; r; H2 @- g 3 y' w( e; a+ l6 `& p, G) H% M
simple.CloseModel(); . t1 o* e' Q1 S0 U4 j
simple.Quit(); 3 D( W1 k7 @4 z5 V0 j- U
WScript.Quit(); 0 \% {3 p6 |5 i7 w) n! n/ P
. A3 p& X2 d, ]$ ?2 G+ G! |( T; O , k: Q# H4 t4 P7 N4 @/ N ]
function RemoteControl_SimulationFinished()
& Q. B. T/ Z% v. s4 i5 Q( I, |2 E{ 2 u4 P9 z% }% z) Z7 p
WScript.Echo("Simulation Finished!"); |