Example of a JScript - B1 J3 D- I8 F/ v: E+ ^
var vbOKCancel = 1;
6 g7 x( Y' q) C% n2 ?# Qvar vbCancel = 2; , Q- E) Q0 E( I- O4 ~
var vbInformation = 64;
/ q# e: |1 t2 K8 R: D2 Tvar Finished=false;
, n* X, b' w% y: T( m/ h) K ; w, y' n# @( X5 `- Z6 _$ d
var WSHShell = new ActiveXObject("WScript.Shell");
! Z |2 ]1 D# Z d 0 U1 y& x. o! X h
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 8 M7 k; k* E# S4 w1 M u8 p# e C3 y& D
. p( _* b4 b* z. C, v, Bsimple.SetLicenseType("Runtime"); / i) g9 X. O. f8 \
9 k3 {# x; B! T, E/ [6 Stry & X h% ^, T6 r' q% K
{
* d; E* W( K3 }9 o4 F5 \; V1 T // Enter the path to a model file! " i! d, }+ h8 W6 |: O( }# F
simple.LoadModel("C:\\Models\\Test.spp");
2 I7 M2 @9 ^1 l- F& _5 C2 c}
0 {3 p$ o2 j: B9 F1 mcatch (e) ) h3 p7 y8 ], p/ X% | k( i
{ ' [$ g6 t" E- K4 J2 D4 J$ h3 n
WScript.Echo("Could not load Model!"); ( |5 Q+ j# I$ Y( h+ s4 L
WScript.Quit();
" p# L, d2 U5 b& s- ~- g} \9 `% _7 L& G3 d! f
) m3 `7 l2 k0 e) ntry
+ F' {1 S. U5 Z7 y9 k1 Y{ : N) l0 @4 `2 N* d
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
$ g+ v6 O( ]9 D6 W r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
$ o" E# W$ C) t _) G, j s9 a! p if (r == vbCancel) L$ O; k I% u& H* h; o
{ 5 L( R; {% I1 a1 ?0 X3 }
simple.CloseModel(); ' I; W0 V* E3 E4 g! C" U. R
WScript.Quit(); ! t9 }! q, O; V& z( P
} % Y( m. t& A+ c$ a
} 5 D' G' ]1 y/ b3 a. I; i
7 {: O$ e0 U4 ksimple.StartSimulation(".Models.Frame.EventController"); 1 h* g2 G: w* q* C% x# @# R8 M. g3 @
& w V+ P8 }: O" Y
if (simple.IsSimulationRunning()) + i+ n' a4 w5 C4 g$ i! z, `
WScript.Echo("Simulation is running!");
8 z0 M+ j$ d) P c# G$ w/ t/ P. z: { - _7 Q( H4 F' C
// Wait until simulation is finished : y; M4 M0 z& A
while (!Finished) WScript.Sleep(2000);
m' m0 s; h9 F# O, X
0 G8 r" R/ v. s- dsimple.CloseModel();
/ y, u6 _( K1 ssimple.Quit();
y" C2 w" m$ ~( L( ~WScript.Quit(); ; V% [! P* P0 ~
0 M- N$ [; y9 |& _/ T; f ! B3 F2 x( X0 R
function RemoteControl_SimulationFinished() * c, v, Y( a: J' g Z' }
{ ) W# S* H) {9 Y& q- }* L8 @# o9 v
WScript.Echo("Simulation Finished!"); |