Example of a JScript
7 o) Q! W7 W* d% p5 N, m" W) Q2 Nvar vbOKCancel = 1; ) V( M" X& c8 l; y: t. U
var vbCancel = 2;
$ u' @5 s7 a n; Svar vbInformation = 64; ; t2 s% W0 H# p) k
var Finished=false;
5 H6 \$ J! A! g, T& e4 H$ N
* q! m3 n1 V6 @' s1 u' Uvar WSHShell = new ActiveXObject("WScript.Shell");
7 a- x7 O( S ?
+ |3 N) g7 \9 ]var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
]& w, O( a" ^" }& j
% c$ d' W( u/ k. l2 d/ Xsimple.SetLicenseType("Runtime");
9 B2 X0 C7 D/ v; b& ?/ Y4 d, w
6 f8 N& l3 o4 ctry ( R) z- \9 r. C3 M4 U) u
{ . b- N5 h/ N9 B
// Enter the path to a model file!
' V: k1 E" P1 G simple.LoadModel("C:\\Models\\Test.spp");
. C, \$ z" J+ ~} 2 }$ G! E! W+ _ w- `4 D, M# H
catch (e) 5 {( v1 ^9 y( q$ `' N$ c- V
{
/ z% R! q2 V. p- \5 Y* c0 i WScript.Echo("Could not load Model!");
1 h, B: p! v/ |4 S! o% B WScript.Quit(); ! @- {+ f. B6 D' a. V
} 1 w8 f! Y y1 T# r$ s
7 P0 h. l% k; o0 d# ttry 5 f7 p e1 _$ {- \( a( L: t
{ , Q) ?# b: n7 C1 r
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
- m, {, Z1 S) ]6 G* ~ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 4 X/ `* E* g) S3 Q# r
if (r == vbCancel) $ d5 \! O' ]. e4 o* C! S* c2 H
{
" @8 J( {. V3 Y [4 I$ H simple.CloseModel(); & m. n+ M# o+ g% f0 S9 E% d3 H
WScript.Quit();
* u5 V/ T/ `* M: T& m7 I }
4 e, d% X) ?+ |}
! ~, | K; x1 b
, H% {! w6 [6 zsimple.StartSimulation(".Models.Frame.EventController"); - R* G( e- X9 A, |- p. Z
/ }# g+ {" @( W% C. U( V0 aif (simple.IsSimulationRunning())
/ T0 L0 Z1 V% h3 M( E& h, ? WScript.Echo("Simulation is running!"); % f7 ^0 s( G; ], b2 e
7 c: P2 O* X$ o1 i$ z
// Wait until simulation is finished
q! u4 J# f, Q1 m+ i1 `6 A8 P6 d2 `while (!Finished) WScript.Sleep(2000); 0 q& z8 J, f v
1 O! b: F+ z# C" ^
simple.CloseModel(); 2 e# T1 C( b U2 I$ \& S
simple.Quit(); # ^' ~/ i0 r0 M( |# O# A8 ?
WScript.Quit(); ( y7 u7 l1 i& A0 J
4 z: ]0 X' J* T B# p1 {% F, E6 P
$ l, Q( G) r; |function RemoteControl_SimulationFinished() 1 B6 {* \& G% n+ { o* z* S* }
{
W4 |4 ?: v0 b2 a1 G& |: [$ g- D WScript.Echo("Simulation Finished!"); |