Example of a JScript
" P* ?/ m: s3 s7 i/ D+ [" jvar vbOKCancel = 1;
# B; C y( Y8 \9 k* q4 ^* Mvar vbCancel = 2;
+ [& u: R- j% Q0 Y! Dvar vbInformation = 64;
7 |# i! l9 D. A/ R! Q3 D5 v6 Nvar Finished=false;
' H$ s6 R, `. R4 w* R0 @+ I+ G5 E- \4 W . M- J" K2 o1 d" `
var WSHShell = new ActiveXObject("WScript.Shell");
8 I+ E$ }; N. w5 h: H 4 F. y1 b: q( r8 F$ G/ ^# [! D- @
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
- G6 H# o! {; m8 `* I& h . G- s" [8 ~, s- F
simple.SetLicenseType("Runtime");
3 `# k7 s5 Q# D7 \* @6 K, q & z! n% P" |9 L" e% O! B8 c: @+ J
try 7 Z: D# V2 N( V; O
{ * r7 r. \* T# \$ Q) L8 \: \ i' l9 h
// Enter the path to a model file! ) R7 A/ {' ?& W. c0 W; ~+ @" P
simple.LoadModel("C:\\Models\\Test.spp");
( W# a( @! Q% s. ~1 K6 t" U% q" Y}
* p# o( ^& ]$ `8 K! Jcatch (e)
$ K+ ?5 [0 s1 H" G2 S% [4 x{ $ ]8 Q/ c/ q1 s* s+ R
WScript.Echo("Could not load Model!");
7 \7 ^1 e* r* f" B9 b$ G$ u7 c WScript.Quit(); ( Y& _1 u7 g3 q+ d2 s
}
: ~: T7 r% _4 M8 ]9 j
- [) ~; L$ v: ^# mtry ; ]7 B& I3 t4 Q
{ 6 N/ B; R+ u1 q! L$ x
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
( w3 X, P: P- O; H% [ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); m- E1 E( I n( `4 [, _8 f9 `6 O
if (r == vbCancel)
+ u* x" u. s2 A: h { / A3 v6 t; y u0 D/ Z3 d) q! U
simple.CloseModel();
7 W$ J) s3 O; R( z; _) `& [! p* W WScript.Quit(); 1 [4 y$ ]5 m4 B0 v: N, H
}
1 N, P) U: J' e6 _3 }9 n} - x/ a1 r+ ~, v1 v: p% t! R
% Q: t( }5 |* K, e! x
simple.StartSimulation(".Models.Frame.EventController"); 4 u6 N7 Q! Y u* h. t! }7 K) b
$ `) w. t3 X3 ^' Z5 o. g n6 w
if (simple.IsSimulationRunning()) , W+ {) L6 f. d% s$ L* ^
WScript.Echo("Simulation is running!"); % }2 r3 X+ f2 f7 V" u; x9 @; n. S( e
! p. _( ]( u" T. {
// Wait until simulation is finished
) W2 W8 y& S& e4 xwhile (!Finished) WScript.Sleep(2000); 2 |( n& v. T5 i4 h4 I
, g; S: T/ B" F$ ~0 g$ n% h a
simple.CloseModel();
. L$ q4 d+ S: c+ R9 a; t( vsimple.Quit(); 9 F$ | ]' T: q: S4 o# E
WScript.Quit();
) c& E P ?8 J( f+ `/ i
E* b5 C2 _6 Y+ s5 _+ D% N$ ^ 2 X$ V \5 S$ N8 h: Q* ?
function RemoteControl_SimulationFinished() H. q2 v- u: t9 l1 I( q* s/ @
{ 2 K+ [0 ^* c( K/ K9 o: A
WScript.Echo("Simulation Finished!"); |