Example of a JScript
" O+ v) T; q5 i0 L1 qvar vbOKCancel = 1; 0 r$ J8 @, F0 ~. u" R& h
var vbCancel = 2;
* x) Y- n/ g) h o; Q! jvar vbInformation = 64; 0 r+ q7 c% g/ ]4 [
var Finished=false;
1 C2 }+ D& m8 e% J/ q2 m h ! Z! V0 `6 b3 f
var WSHShell = new ActiveXObject("WScript.Shell");
$ @, o+ Q0 }& `6 p9 l6 o
8 x R+ G. A1 {& Z" S7 @9 V; I, Svar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
/ B+ Z" x7 ^0 r! w: e) A
; }: g. |' B6 M7 e" r: Asimple.SetLicenseType("Runtime"); $ p! r$ s v( T8 S- {" j& J
: G1 O1 X* d- W1 `. j" ktry 8 w4 W' m) ?" e/ r$ W0 }
{
6 C: c. G1 [( R" m // Enter the path to a model file!
7 o1 a4 l- s: W q+ }# g1 G4 D' M simple.LoadModel("C:\\Models\\Test.spp");
4 ?3 i4 u$ f0 T} ! Q; k8 B U( P# N
catch (e)
; m/ ~/ b: t# w6 W% d# i- r2 E{
7 ^ G2 n+ Z: R2 Y2 \9 ~8 @ WScript.Echo("Could not load Model!");
~/ Q, K9 j' Q; } WScript.Quit();
) l+ X9 ]2 o& p+ j+ h} , P0 Q) j: v1 Z; S# J
* X, p/ U3 N, E/ gtry
4 [' x3 |: N) N{
' v4 ?3 u' _% o% W: Z; `- D simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
6 C( Y! e- u7 z: A$ C r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
$ C# z! r# S( K$ p1 I/ _3 z+ F; _/ W if (r == vbCancel) 2 B7 }" I+ ^# D7 y9 t' W7 d* a
{ ) O/ n/ @) b! j3 ?* l" I m
simple.CloseModel();
4 J1 j/ V- A( |- f/ H) M: W; g WScript.Quit();
% y3 w8 _, M/ O8 S; C } ) D- a! [: U$ c n6 L+ z
} , C, F5 z6 |% m
3 h1 [8 `1 s/ q) Y
simple.StartSimulation(".Models.Frame.EventController"); - n! n1 H5 |1 g8 x6 O' \% c7 X
5 u% `9 ^& b) ?$ F; `: u4 d3 Cif (simple.IsSimulationRunning())
+ C$ l! ^0 N, P# \4 E- O" o WScript.Echo("Simulation is running!");
. [- J) Q2 B8 u: o8 f# n
7 f5 }7 t7 l/ y& Z# a& u// Wait until simulation is finished ( h# U" y8 W. k: d S" L
while (!Finished) WScript.Sleep(2000);
* F5 z/ z' q5 @; |/ P S
3 n+ a0 D) e1 B- |* ksimple.CloseModel();
/ y. |4 a! P, P1 ?& X' csimple.Quit(); / Z! d' N) [. \! s4 r, |
WScript.Quit(); & Y: V! S8 K% _9 {2 P; m% P0 s
9 q* B+ g m: s9 }' |
( L3 K+ T- p( e0 {. q& Hfunction RemoteControl_SimulationFinished() / a, L: I0 K1 @( Q8 E: c
{
* E8 ?- `) A2 ?6 C! {7 D, Q( ~ WScript.Echo("Simulation Finished!"); |