Example of a JScript
+ F% O0 I& X6 O# Mvar vbOKCancel = 1; $ {2 @$ [9 d$ ^
var vbCancel = 2;
' `+ Z0 ?* j- M e% Vvar vbInformation = 64;
! V9 C& g$ c' Y- `/ s. jvar Finished=false;
( I: _/ k/ k1 x- H& h% a; x 8 U/ V* T: p& T2 X6 \
var WSHShell = new ActiveXObject("WScript.Shell");
3 U4 M4 W, g- { O3 [+ Z8 o: f 1 s+ k4 g, p* g- R# P
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
& P! R- K4 s$ {8 `& d* I# u1 m1 ]0 n
) ~% ]% x3 ^0 i) B! G; Nsimple.SetLicenseType("Runtime"); 3 G* ?4 w& d3 x1 B; Z6 U' d
1 n2 _" [9 G- G; n* itry 1 r" R0 a) j7 q* k: |. U) ?4 k
{
! z# b6 c, Z$ r; ] // Enter the path to a model file!
* Q' w7 t+ ]6 Y7 q0 |1 T simple.LoadModel("C:\\Models\\Test.spp");
, ?: c+ U! p; k$ m, {} ' }/ M8 F6 f% k f! ~* T* s
catch (e)
4 T4 z3 S+ }! \$ z, |{
! i7 m: U! E% _$ M$ q! P' p" w WScript.Echo("Could not load Model!");
8 A' r5 b7 H5 u0 o) v: @' c WScript.Quit(); . y* C% y; } b/ s% V. H5 I4 M
}
8 `2 m+ D' Q1 t% ? 9 h y1 D; s3 j5 z
try . O& v3 \( \% y, o2 W6 O* @8 A
{ 9 a: i8 x/ S6 q9 K# e2 J
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { " J# Q- l& a! _, N2 d6 S# q
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); * v K) M" R; F8 |, ~. Q$ e
if (r == vbCancel)
. ^9 }% @- R/ t7 f- V/ p { 3 ]* ~3 m, a9 c# Y& l. X. `
simple.CloseModel();
5 I' H/ ~5 R/ \2 j; A" p) V9 g$ {. \ WScript.Quit();
* f3 a( H( @" ?! r; s" X1 c }
4 r. O% U& j# u4 H2 B} . y6 I9 I' f3 V0 ~
* U: O& T* {7 l7 o
simple.StartSimulation(".Models.Frame.EventController");
. q1 Z$ A; Q b! z; j1 b
- y$ Z4 h# A: n4 ]if (simple.IsSimulationRunning())
/ W- e( @4 n5 D* t# E& q WScript.Echo("Simulation is running!"); % r8 ]) h8 F) c: z9 P) \
/ s4 p; H' H+ d// Wait until simulation is finished
3 j2 S% H; F0 O6 w5 E" Nwhile (!Finished) WScript.Sleep(2000); ) [% k0 r7 k6 {. C. m
3 ~/ d* t. D( p8 W" X" Hsimple.CloseModel(); 7 C9 |" s# `+ x2 q4 O
simple.Quit();
0 n+ n5 m& A$ V# M4 ?# v% n4 ]WScript.Quit(); ^( b8 ]/ Y2 k- t
/ B% K& Q, c3 G) m7 s7 h
7 ^: D9 i# a2 w+ M" g1 ffunction RemoteControl_SimulationFinished()
% E; S# \6 h# P! Q! S{ ! M1 ^- b& x7 f9 r! F- R& ?
WScript.Echo("Simulation Finished!"); |