Example of a JScript 1 @: ?% |* A d$ z8 y9 s; U
var vbOKCancel = 1;
$ E! @4 H h4 t$ b* h3 jvar vbCancel = 2; : Q! m9 Z h0 E% N6 e2 u# ]5 f
var vbInformation = 64;
/ w$ p- m( E4 ]- T, `" C0 Xvar Finished=false; . M. A8 q1 g+ `. g! ?" b3 [
$ \, e& V* v. u* N9 cvar WSHShell = new ActiveXObject("WScript.Shell");
, j& H Q* V) q: U " N0 e5 T; i7 h7 G8 m% b3 d
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 2 G! b8 n6 I9 v0 T
b# \# K3 p& ?2 R6 V3 Z$ ~' `
simple.SetLicenseType("Runtime"); - q$ G8 i0 E) ?& j3 ?
$ q0 {- a( b7 atry ( J, ]( f y7 g" U+ C d# o
{ ( H0 h4 [+ H5 {& ?
// Enter the path to a model file!
7 E* ^/ p# ]) \1 R' I: s simple.LoadModel("C:\\Models\\Test.spp"); 9 ~# ]3 R, f8 Q, ?
}
& q5 ]+ L0 f8 V7 m7 U" h+ g- y/ Pcatch (e) * M" j8 x* e' {% O/ L* l- A
{ 6 O( L( m* K0 ]- Z) x
WScript.Echo("Could not load Model!");
6 _6 z. G& `) }7 ]) [1 | WScript.Quit();
" P; s) ?. d. q! p' ^; L3 s' o. O} 1 v2 b1 }1 Z9 @9 A0 A% _
& D$ {) w3 Y" J M9 P
try % t5 l/ q/ q/ c G7 W6 E$ [. \8 y6 r
{
! Y$ I* o& [( W7 Z simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
( l' M! a+ S$ G- w r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ; ]5 Z0 I. a7 D
if (r == vbCancel)
) h- w% U% f5 ]! R; C { 9 ~' V) @5 I A
simple.CloseModel();
+ { X" U% v5 O0 f- G$ ] WScript.Quit();
+ ^( Z- B/ o/ D" h/ y' B, B } % S) q0 X' y9 ?0 k3 O* P* O
}
, [& V0 g" M, n, C$ M- M! C
- I9 h5 X v5 Ssimple.StartSimulation(".Models.Frame.EventController");
: B8 C8 _1 q% v# i 4 ?" n- G8 E- N+ T0 L; W m
if (simple.IsSimulationRunning())
9 \5 u# X% D* t4 e WScript.Echo("Simulation is running!"); / s, D4 z5 h8 g' l4 b3 Q( w
; m) n m; S* W& w6 n, Q' m C7 J# ?// Wait until simulation is finished
( A+ n Q" g2 n3 L- M4 owhile (!Finished) WScript.Sleep(2000);
; Y; y5 g# I, E5 N+ d0 @* e! n
z: ?/ Y9 J! G* bsimple.CloseModel(); , M4 q5 T" ~1 O; X2 ~0 v
simple.Quit(); " Z' J+ d* T7 n" e
WScript.Quit();
5 L' M4 h' @9 {* J7 E; R , H6 J/ e1 L. Y1 _- ], K/ O
" Y/ t+ {/ h$ _ v
function RemoteControl_SimulationFinished()
; o2 t7 |2 z8 t% L7 `% _0 {' I{ 1 j @1 g, X- }/ a7 p6 p
WScript.Echo("Simulation Finished!"); |