Example of a JScript
, l$ U, ~3 E6 fvar vbOKCancel = 1;
6 h' }) `! k0 v: [" K P$ j# Cvar vbCancel = 2; ' z" e5 i8 [ ]" w/ @
var vbInformation = 64;
. |! b- G( Z$ \5 E- bvar Finished=false;
8 e) j6 O6 H X( T% s2 {
+ y0 H0 o; O5 t* Pvar WSHShell = new ActiveXObject("WScript.Shell");
" l& l4 q* J' ^ s6 j2 q
* }; _5 N9 {. Wvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; b1 l" Y+ }; j: N! m& l " x' T3 J, P# J. G: F
simple.SetLicenseType("Runtime");
3 W$ A! f5 J, P2 N' S' B" V5 O. ]
' h( {( ^, T1 w" etry
' u9 M& ^5 ]- Q/ A; w" K{ 0 G2 D# L( ~ |# B6 P* I$ D# v7 K1 O B
// Enter the path to a model file! `4 z* b3 u; j' _$ _/ Z, d ]1 D
simple.LoadModel("C:\\Models\\Test.spp"); % X, P0 E& r( R8 h5 W, K, h" E5 V
}
) Z, Z& c3 W. A8 K) qcatch (e)
$ c4 L" T# t O$ d: e+ s, q! |. v" T{ - y& T5 Z! P& r8 S g$ x
WScript.Echo("Could not load Model!"); 4 F: v2 W& t. i8 S/ F" j
WScript.Quit(); ' G1 n1 |6 F g u) |; ~4 N
} % }: ]4 t( U7 ?$ U
; x) i) B( }$ D' Q. T7 d% J3 V. t! ]
try
0 _- M& t }* S* {! E3 q, e+ k{ 0 {* { ]3 _$ W- @+ `( i E
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
3 J+ P7 a4 Q6 u- j( |# Y r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); + L: g. q% F) z; g0 l
if (r == vbCancel) " q- a# n$ {, l7 M2 L$ f- H9 A8 q
{
# N h- F, O7 t1 J simple.CloseModel(); 4 ^0 N- Z! k5 V7 ?
WScript.Quit(); , m- q$ `. C9 B
} * \' ~9 b7 ]/ d. }* B- y; h
} , Y9 j, Y) G% N" A0 d
$ j6 a8 w# W2 Gsimple.StartSimulation(".Models.Frame.EventController");
9 {# D+ c+ Z* K3 m ) s& h1 r; ?; B$ e/ L; X+ W2 f
if (simple.IsSimulationRunning()) T* `5 |; d2 C1 |0 E
WScript.Echo("Simulation is running!"); # n" E/ U5 O1 D8 E& q# @; u
( Z* d& ^4 D' i: F4 O* |
// Wait until simulation is finished / {7 [- V8 g, J# O9 b$ J
while (!Finished) WScript.Sleep(2000); $ B) {! |9 A" c/ n
- w) `9 b5 P. G2 O+ Z& e/ {# O
simple.CloseModel();
0 o9 ^9 N' b7 c- o3 ~4 y6 _simple.Quit(); 8 z3 K5 p: I* [- M( p9 _9 r+ p
WScript.Quit();
$ r, {+ W6 `5 _" k+ a2 u$ A
! B2 S/ n$ [2 |8 b4 M m: C
8 P5 O& h* Y1 {- E" C+ zfunction RemoteControl_SimulationFinished() $ y: C# ]+ r# {( m! r
{
+ B4 ?+ v m4 B, Z WScript.Echo("Simulation Finished!"); |