Example of a JScript
/ ^# E z7 ^+ P* M% D8 nvar vbOKCancel = 1; . R6 X0 x% m- q! f E: _
var vbCancel = 2;
6 ] \: [6 |# M) s$ V2 v6 r! l. \3 Evar vbInformation = 64;
2 S- A$ K9 R$ h, Y: hvar Finished=false;
h6 H. H& e: n* h% O q
$ H' L' ]# ^3 g8 t3 f5 Q$ Avar WSHShell = new ActiveXObject("WScript.Shell");
/ F' j, R+ ?0 I" r+ N8 x
1 I# {" F+ y' ~/ @$ U. z7 [; p# O9 pvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); . w4 l% E, x( K L" Q% n& W' U
' R" ^" x4 g" e& F) C" g. _6 h: |simple.SetLicenseType("Runtime"); % K" _5 `& k" _2 i6 x" E+ L8 O
3 g% x, u: C" |) q! r+ U" }try 4 ~! w0 R% u! i
{ + G3 _5 W# L6 F! O1 }
// Enter the path to a model file!
$ c+ H& X( q6 p simple.LoadModel("C:\\Models\\Test.spp");
% P$ n }- H- w$ l, l* t6 I}
$ D3 S1 I3 `: [8 |! ocatch (e)
" w5 M2 D7 @1 ~3 ?1 ]{
0 |! ?" O! d0 w! G8 M# ` WScript.Echo("Could not load Model!");
! S- U6 z! H v; |3 J/ H$ F' C2 G WScript.Quit();
! |5 C# X0 a" W. [0 J5 F: x}
2 m: V" J2 ~7 k. U+ v/ A
% `% }6 y4 @7 F* P" n4 T; Stry
2 B/ Y. \3 ]( X2 P3 S/ s{
M7 ~; M# D, J- U- q' ]$ e9 E+ }- l simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 1 n+ c- k! Z* J) C0 B6 i' n' A& X
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 8 p1 _7 c2 c G
if (r == vbCancel)
" t4 ~+ H9 b2 S { $ ?, B! N x! s* t9 Z! w1 O. w% c6 S) o
simple.CloseModel();
. ~- i1 ?1 k' A, L! A4 g5 A WScript.Quit(); 9 [. k2 T4 Z5 F; D
} 4 B1 W! D% |" v6 j* p
}
Q% D# i( M& Z# G" l3 G 7 ^: J5 v9 y5 V. b# Y' G8 h) a
simple.StartSimulation(".Models.Frame.EventController");
) }. [! f% I6 F; |# T, O, J& v 1 E# t8 E) v' ~( o# x
if (simple.IsSimulationRunning()) ; J# V; L9 b; ~: V
WScript.Echo("Simulation is running!");
# l- v9 | m3 k- E7 x 7 A4 l# B$ [! H7 b5 h& M1 M
// Wait until simulation is finished
4 |5 L1 q0 q3 Z1 P, iwhile (!Finished) WScript.Sleep(2000); - A' {. B. c7 D7 E3 y4 U1 u9 ]+ }
6 g2 Z1 E: ?0 e. ]8 ^simple.CloseModel(); ' F) U2 z/ F: t
simple.Quit();
% ?( t7 n5 v3 A% b8 o7 C) cWScript.Quit();
) P' q, a+ A" s
/ U' F$ q* A$ b( X* }) {( A
; W6 N( g6 ?. H- W0 ?$ pfunction RemoteControl_SimulationFinished() * J* W* o3 C. k1 [
{ & V4 C6 I" h8 C
WScript.Echo("Simulation Finished!"); |