Example of a JScript
" r3 R) M) b: lvar vbOKCancel = 1; $ M7 N) J5 H1 P) N, W' Z* x; g5 U
var vbCancel = 2; 4 B# n0 |2 q4 h# R0 b9 F
var vbInformation = 64;
+ e: u0 o, u. z- f# ]var Finished=false;
( v- s. @4 q. c4 }. R6 y/ c # I3 a2 m" V! c1 `5 L- w5 j
var WSHShell = new ActiveXObject("WScript.Shell");
7 d8 ^0 h/ J* a$ G
8 W# H4 Z. P$ G8 }var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ; ]% i9 A0 Y: L( V) T! T( w
8 L" n/ M, g- X$ p0 \2 {
simple.SetLicenseType("Runtime");
' T( {6 ]9 d0 |6 @- \: l5 j
+ ?; n6 h7 E$ V9 b+ u" O9 jtry
( ^; |/ v0 d3 f{
8 ~) u3 M; y9 g$ V5 W( r; x // Enter the path to a model file! ) M4 k' N- W7 G1 w7 V- N; J' V/ N
simple.LoadModel("C:\\Models\\Test.spp"); 1 ]+ S; g( u9 M$ }
}
s5 f3 b3 ~" P' n' x4 Z7 }catch (e) - [' v, y4 |. h1 z0 N
{ ) }6 Z& O8 f% e C
WScript.Echo("Could not load Model!");
: k$ O0 n9 m/ H f- q* b( L WScript.Quit();
* W2 t( n' p! `! s- a}
% ]) i2 o# k% ]$ g) e
! [- }1 F4 i# j6 rtry ) T3 L+ A; h4 ]6 f
{
8 Y( Y; o7 l4 h1 g' i9 d S simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 4 ?1 t8 k p/ z v5 _- I
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
. o- ]4 p, h6 w3 U if (r == vbCancel) ( T0 D, S ^6 }" d. w& N, V6 f
{ # L/ M% p. h6 y, z1 D* l0 {+ k
simple.CloseModel();
7 P- v3 l7 L W WScript.Quit();
3 c% D8 O6 @6 C! \* v+ _1 S, q2 E }
' H+ V' q6 A# d- G' w* z' F}
: x7 C3 S7 Z9 I2 \2 u) t) O 4 `* r. Z7 s4 q+ C' P* L, M
simple.StartSimulation(".Models.Frame.EventController");
5 A* d( u: E2 A2 a+ q& B' U
9 H& ?! H8 _3 {+ K8 ]7 N0 Sif (simple.IsSimulationRunning()) ; U+ F. e; f( w( S
WScript.Echo("Simulation is running!");
% S" g8 u$ e% E" b9 b. e( Y6 V ! b+ A" }/ X! U' A. |
// Wait until simulation is finished 0 s$ n! |, ]% w0 f: N
while (!Finished) WScript.Sleep(2000); 3 {) a' U9 n, `1 J4 |6 G
9 c1 s, n& D' p
simple.CloseModel(); 4 g$ p6 N5 r3 x8 ?7 m Y
simple.Quit();
, I# b9 j3 x1 @5 Q& {+ eWScript.Quit();
8 b2 _9 @, N' |- \5 n 7 u6 D0 \' n, x' @4 L
- y% ?4 b# S, R3 _5 {9 U; D+ Ufunction RemoteControl_SimulationFinished() + F' n9 |/ @# { l' J, ~2 [
{ * ^1 @" t. ^5 ~# @0 ~
WScript.Echo("Simulation Finished!"); |