Example of a JScript
; H) |3 V! T* X0 u) h! l* H0 E. ]var vbOKCancel = 1; ' v$ l3 f, S4 v" B& q9 X
var vbCancel = 2;
8 r0 |$ l+ X% qvar vbInformation = 64; 8 b! O1 {1 V+ p3 C: L' D
var Finished=false;
+ e( P+ |1 @# @9 ]1 A
6 O$ {; u+ J" A- N$ Gvar WSHShell = new ActiveXObject("WScript.Shell");
- ]# A" B, E8 E! `$ D+ f
* F% ^5 }( m5 p* V& H xvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
- [3 O4 K8 |" [7 c 7 _# b B) D! _1 _
simple.SetLicenseType("Runtime");
, d' B7 Q" n* }; t* Z* J6 f ( V3 v$ y( b' d" j- X3 s1 u
try
( B( i; ^1 D. ~0 ]{
g6 e/ T: [# q0 ~ // Enter the path to a model file! # H$ ~( l. B: V2 ^2 W0 g: g
simple.LoadModel("C:\\Models\\Test.spp"); , @+ b2 j; z8 t. y
} ' ]7 [" w6 i% Z7 c- X" V0 R
catch (e) * {. _1 }6 D1 T6 V. [7 M
{ # f9 g2 B8 y) H {# K p9 p
WScript.Echo("Could not load Model!"); + Q3 k5 \) S2 ^+ o3 `+ h
WScript.Quit(); W* [4 r2 M' M. J9 x1 p& Y
}
6 {! ~: i0 L5 ]2 i8 s, a
/ L9 d4 \; w1 a" ]% `( {* m& ^try
! D8 T' j/ ^* J. b4 t/ y{
9 t, b$ `! \; ~/ A* t7 G simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 5 o* s; O& ]) ^) R; A2 N
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
& w2 D9 G3 s5 f! T* f- } if (r == vbCancel)
9 V: s2 t4 G* a5 b9 J { $ q9 [$ }) Q5 `1 K# U
simple.CloseModel();
. C( f. j* k$ o& k6 S: ? WScript.Quit(); 0 B. _6 v2 U5 z1 z# [
}
3 O4 r5 S ~* l/ ~7 K7 w0 q}
4 m5 j2 e. s7 i
' Y# V+ {& |' }6 z, fsimple.StartSimulation(".Models.Frame.EventController"); 6 C( Y7 C. O: B/ y( y6 c/ v u
% z7 K8 D5 {! J5 y% P& ~$ m
if (simple.IsSimulationRunning())
% T; l: w& H0 }( _ WScript.Echo("Simulation is running!");
# W5 ]% e( B6 r2 X# d9 K , x* B+ v: k2 d- D+ M" x% P
// Wait until simulation is finished ) v: f6 L6 ]8 X) X% q* S: Z
while (!Finished) WScript.Sleep(2000);
/ l6 Q, p+ I0 \! Z# L
6 Z: c' K# S9 a& psimple.CloseModel();
9 e, q! R+ y3 G1 o: @- [6 [simple.Quit(); ( Z6 A7 T2 b6 F+ H3 H
WScript.Quit(); / G) h: ~/ Z2 [) C: w% r
! v9 z, K0 Y' S: W2 C1 l. S9 O9 x) t : l, V. U, \8 ?: _( i5 X h% N" x
function RemoteControl_SimulationFinished() 7 B+ V0 W# ]3 i/ l0 f& h" k! W
{ ! q4 O. I7 u, O, t9 D0 |
WScript.Echo("Simulation Finished!"); |