Example of a JScript % G. H' F+ }$ A* }7 G, S4 ^
var vbOKCancel = 1; ) F. [) } V$ V5 v
var vbCancel = 2; 0 X# d% \: ^. j. H4 O1 e; a3 d
var vbInformation = 64;
+ p0 E5 }0 d, L, Qvar Finished=false;
- w l1 w' z% P9 T- V1 K
7 U% s; F S9 G4 Tvar WSHShell = new ActiveXObject("WScript.Shell");
9 `: n# s/ [1 {' H ( k7 S9 @* R$ { v4 M3 H w. u
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); " ]$ ?' [. h4 A; P1 w
+ m% p) d, D G' K/ t# p; k
simple.SetLicenseType("Runtime");
1 V! f* `) c2 P9 G4 Q
% M2 C2 r4 S3 x8 L+ L5 Ltry - q" n* T/ ?# [0 e
{
; z; R0 }, W. ] // Enter the path to a model file!
, G4 X6 _/ A, {, e/ d5 K9 a simple.LoadModel("C:\\Models\\Test.spp"); & C# @0 `- D' H+ u! Y) c1 n
}
3 i( `* R9 g3 vcatch (e) ! y7 S3 M( T' i
{ / L2 f7 x# f0 e6 e& I$ |
WScript.Echo("Could not load Model!"); ; g# E. z$ i5 j; b
WScript.Quit();
& }1 b- V% k4 L7 F$ H}
" i& U4 y1 J( `) {7 V. x- K $ J$ E- g9 y1 ~% g! [
try 4 u7 F& ^: F' {8 j+ h5 C j
{ 2 j9 m! Z/ T* J% P) U& U0 F7 i
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { . O/ j; S/ H$ P- a) g: S% T) T
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ' _5 l0 W* p' w+ s, M& \4 S
if (r == vbCancel) 2 K( \& E( [* ^ O+ V6 O
{ " }0 V x, ^# \9 ~0 F
simple.CloseModel();
+ Y: I3 D/ n) @& O0 F7 }9 G3 r WScript.Quit();
' t9 r3 K8 _. N& d$ g4 F- l+ r% ] } 1 C7 C" }6 P) f2 ]
}
! @; s% ^3 w6 J ^+ t
( C+ l. e& c; u- b: U+ dsimple.StartSimulation(".Models.Frame.EventController"); , A- x1 ~& v- r
|; c- Y8 D$ L" \+ W1 d# Kif (simple.IsSimulationRunning()) 2 M( c, x4 e! N/ x5 L* K
WScript.Echo("Simulation is running!"); 2 m1 d* r3 M. ~8 s# `* r
1 `& G' Q6 H! X% W// Wait until simulation is finished
2 H7 G. X3 j/ d! Cwhile (!Finished) WScript.Sleep(2000);
5 z4 N* f; O0 p; t# ~( ]% \
. n8 j3 ?/ d5 K$ W& @- N. Hsimple.CloseModel();
* d4 Y+ F+ j+ |simple.Quit(); ) d' a1 r1 }( a* ?1 c2 h' F5 S
WScript.Quit(); 0 r# E# i/ A) |% e5 J
" Z" n( m& K0 K
1 S" t- U0 l9 M: | f3 `function RemoteControl_SimulationFinished()
. |! z+ X7 W" A. E+ X{
/ Q( g5 Z4 M' K7 Q9 a WScript.Echo("Simulation Finished!"); |