Example of a JScript
x. j7 v5 g5 \9 a$ z* T% @var vbOKCancel = 1;
6 w# H& _, @0 p& O" k1 vvar vbCancel = 2;
3 \+ l. A Z! b- C( z4 avar vbInformation = 64; 1 m$ H S7 z. M( p
var Finished=false;
' ]- U" ]0 {2 S/ m: @; ]4 _ - X- }: `& t: @+ U' f n' g
var WSHShell = new ActiveXObject("WScript.Shell"); + e' V' ]8 _5 e% P) ^2 o& T" g
9 l, s/ g$ N3 j% avar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 7 ?% w- L1 \5 Q7 C
. i1 x+ `5 Z- j5 Psimple.SetLicenseType("Runtime");
5 `" q& J, @+ X
. f# a4 j! W% j' V, l; ?try , O2 U0 I% b' B8 N4 E) b
{
/ A) E: F6 ~( I. K" S/ H // Enter the path to a model file!
0 q. O8 ^. Y4 R0 ]$ B; l6 ~+ O simple.LoadModel("C:\\Models\\Test.spp"); - Z4 I7 m S- r8 k. p' o# R
} $ [) ~' k1 g! c% s% F, ?! K/ m& D
catch (e)
; [2 A8 D1 Y# Y- m7 z* u9 a{
9 S& y* v, V# t `9 l WScript.Echo("Could not load Model!");
+ r2 S' G+ R' n3 a0 s% M( V6 b5 W WScript.Quit(); 8 w' I* g* _" Y/ z$ s
} * Y/ d3 B4 ^. c! e. Z, E( n
0 ^' S0 S, A! w/ Z; v* E
try
) W! @8 U2 r& E3 h8 L0 w$ N' C{
6 R# ?2 ^1 f' r simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
3 S1 k: T( [$ m% @ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ( S; _ {) D' E1 p g. h2 d
if (r == vbCancel)
. a3 S p! I6 d, @: r0 ~ h9 V {
1 O. A% u0 t1 M9 P simple.CloseModel(); # z: B5 } v! U
WScript.Quit();
9 Y8 Z& I7 J0 V: C2 V }
0 r' l& u. _% V, M2 t+ f" d! O} " O6 M; s3 ?5 q, M' Q& c" K* L
. r! N8 ]- O4 c4 E) T) m
simple.StartSimulation(".Models.Frame.EventController"); / W- _2 S) M; T; g# _0 a; F9 z: t
7 u1 j6 w( R, ]% W/ ?5 Zif (simple.IsSimulationRunning())
, j$ s; R' }7 {6 P7 S* F WScript.Echo("Simulation is running!"); . H( S7 o4 r; R: u5 _! S
% P+ D9 P& g8 ]4 u7 O1 E' q1 r) J: M
// Wait until simulation is finished
' b2 K2 z4 B# K+ f swhile (!Finished) WScript.Sleep(2000);
; {7 P. K- R7 B5 b
. G7 w/ B3 Y% s6 @% hsimple.CloseModel();
4 N4 T7 w- j5 b) m: @2 L" Dsimple.Quit(); , u6 p8 j, u4 Y4 U
WScript.Quit();
6 _& s7 V( |# V3 T# M" T7 @
0 p" d1 L% n/ n) i w2 x! o- F
6 i& d$ e# F* cfunction RemoteControl_SimulationFinished()
' l4 \" z: H7 j3 x; U{ ; M- b! ^ \6 G7 h" |# }
WScript.Echo("Simulation Finished!"); |