Example of a JScript * V+ r2 G( I+ G
var vbOKCancel = 1;
/ U& q2 G2 N7 A- ^8 F5 O* h1 u( Kvar vbCancel = 2; & W8 \- H# T8 v7 `1 c
var vbInformation = 64; 7 a5 _7 a8 A( y0 k3 G* o# j5 Q; E
var Finished=false; 6 @" S; D4 p; Z& @' b$ V2 h
5 r0 y' Q! z& V) }* a2 ~9 w
var WSHShell = new ActiveXObject("WScript.Shell"); ; g( }5 a. j/ @+ K2 W
8 k, Z D* \$ K' u% ivar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
) I, ?7 n4 u" u9 d/ ` 0 z: y" a$ u5 S0 l/ \) s* }
simple.SetLicenseType("Runtime"); 6 h, d% `& @/ t" C% Q6 U
2 i5 S; @/ x6 ttry
, q8 I- z+ J! b8 w& f{
! i3 i: j0 }, R# J# p7 e3 m( w7 | // Enter the path to a model file! ! V2 V6 @1 j9 @, N; F
simple.LoadModel("C:\\Models\\Test.spp");
/ ^/ B+ K- p" @3 ~" x} & M; e+ Y& p! ^% b: R& Q
catch (e) + s: k# m) Z% ]% r7 G0 R3 N. V, ]
{
* E. z! @! B0 ? [6 M& m, c WScript.Echo("Could not load Model!");
5 I4 m* ]5 u# l1 q/ l$ m WScript.Quit();
# z0 F* p2 h( W3 c3 h" X$ ]}
7 J3 B7 ^% H9 j6 h" z
' d% ~+ s# T0 dtry
# E0 @; {/ Z1 A5 x; a2 c; g{ + V/ G- u# |4 ^
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { * E, _6 I+ Z" Q+ ?1 T: G
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ! z; p* x$ o1 Q9 r8 C4 W
if (r == vbCancel)
1 s. n' w1 Y! l( v; B2 t { ' \; |1 \2 T: P( @5 Y
simple.CloseModel(); 5 i. S# [$ A6 @8 a& D
WScript.Quit();
' s( \0 h2 I+ U2 e }
; U; R! N& k2 H+ A}
3 I0 P2 M' x! F0 L7 M " `( j7 g3 Y" V1 ?
simple.StartSimulation(".Models.Frame.EventController");
( t! m! k. Z& T# ]' D- X 7 k/ X/ G& ^+ L! m
if (simple.IsSimulationRunning()) 1 Z S! Q0 Q# k; M# Z
WScript.Echo("Simulation is running!"); + S+ h% W! ?) |* D: p
4 X' _4 ]' X5 d1 @2 D// Wait until simulation is finished
0 M+ D+ e" Q; Y4 b9 Zwhile (!Finished) WScript.Sleep(2000);
' b$ h/ T$ b& R0 P; [
. k& Y* y* x" p, t) v L% F! `simple.CloseModel(); 5 \- D+ o1 G, _* G* B! h
simple.Quit(); 7 g* K) ]% T5 a& \: P* f
WScript.Quit(); " j- ^0 j' \) ^9 e3 F' P
3 Q) ^3 N, }% y( D9 ]! ]: F6 z
# i/ s4 u9 z8 r9 t2 U
function RemoteControl_SimulationFinished() + _$ _ \$ k. [7 T* R
{ $ H/ a- c2 l4 F2 W( ~- l+ a. D
WScript.Echo("Simulation Finished!"); |