Example of a JScript ! R" s: I. l# X# ?+ [) k( ?8 K0 W
var vbOKCancel = 1; 4 [1 _9 z+ ~' ], n4 F$ y e
var vbCancel = 2; 0 U8 i( x3 l% G; h. j! P* _
var vbInformation = 64;
9 K$ ^5 H) L' o+ n8 l& S: Avar Finished=false;
; Q3 ?) S& E2 I9 I - E2 D: F8 K9 b4 @1 W
var WSHShell = new ActiveXObject("WScript.Shell"); * y/ s2 G, E# `( W! c
" T' h9 B( Z" N" A* N E3 N7 e: _var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ' _, v) L5 `) O( {: N9 |
8 Z6 A+ d5 W& a" p$ A( J" osimple.SetLicenseType("Runtime");
4 i4 x: t: l& k: I / A; ~+ F* E3 m. r8 H
try
9 I: u+ J! X8 b- M# l( L; x$ v{
0 O9 W; M. i# ~6 M // Enter the path to a model file!
( r1 Z/ t4 U9 o1 N4 ?, H simple.LoadModel("C:\\Models\\Test.spp"); 1 G3 S" o4 @; S8 i& ~; U& v! |
} ' X( p+ j4 g* y3 l7 O
catch (e) : u& z! w0 P# h1 m. U$ s
{
6 L: S" V9 C8 i, m+ D" \ WScript.Echo("Could not load Model!");
2 [+ b& u4 k/ o WScript.Quit();
; \: E. }5 E$ D0 x. G1 y( A4 R}
& |' h) t5 w$ y2 v- F1 S$ W3 E : N" t% B: n) o
try
7 i2 F* {! @: C! G2 [{ ^5 e4 N. A) I9 K( O1 ^
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { * R/ ?! n5 P; V! d
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); # z4 }% |" }# W; i ^) ?
if (r == vbCancel) 9 S/ J9 n o- f
{ " h9 i: G2 j& L- c- O/ }
simple.CloseModel(); 8 q, V) i6 G* J. r7 y
WScript.Quit();
+ M4 ]4 M& ?% X0 s; | }
. ^5 X! O6 j. W k& w2 e} ' K' M% O2 d( o4 G
% {5 q2 r! d/ b+ R. ^* Asimple.StartSimulation(".Models.Frame.EventController"); 9 {. B# M6 b' ?$ M3 x# n
" u/ g D+ P1 v- R) I& V& w. [; i
if (simple.IsSimulationRunning()) \, E4 q: B1 M- |* L% K
WScript.Echo("Simulation is running!");
8 D# x) I. }& y' ?
* b/ z, ]& D; g// Wait until simulation is finished
, L V8 z" }) L0 O. Xwhile (!Finished) WScript.Sleep(2000);
# N% B1 M1 e9 t/ Y
7 L. j3 i( i* {. v. a9 r" Tsimple.CloseModel(); 8 p) Y6 M& U7 T+ F
simple.Quit(); - K9 }; \% q2 b. ]) J
WScript.Quit(); 5 a3 y+ e# F5 P+ Z
! ~' t$ R, V; _/ M( F6 c$ _& x5 N
+ U( u+ v9 B! O% |, f' S& ufunction RemoteControl_SimulationFinished()
* O5 E- e0 L1 ^{ / @/ `( x, C) ^. v* Q( z
WScript.Echo("Simulation Finished!"); |