Example of a JScript
4 C* x8 P# S* E: v2 I- Zvar vbOKCancel = 1; ; }" s: I) z9 T- H
var vbCancel = 2;
- v; T& \, {( k' }6 {+ _" Nvar vbInformation = 64; + K) j. x7 N; P3 U% n! C9 U& x$ p
var Finished=false;
" a; d4 Z5 Z4 w/ x5 P ~" E . T7 A! Z; Q) F( a+ M3 b
var WSHShell = new ActiveXObject("WScript.Shell"); + E$ q9 f8 T8 D9 K
% b- e) J6 e$ S5 n" evar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); [3 p5 X8 [3 M, J9 l
5 J* ]5 l* | U: ?
simple.SetLicenseType("Runtime");
6 b* ?& ^2 H# i6 @* e0 ?2 K 3 r0 `' _$ K2 L4 A- \2 W
try 3 e9 v" k! H4 K5 ^+ ]% R
{ 7 q5 ` d- n: F. u. R7 X
// Enter the path to a model file!
) c j0 h5 g0 ?) H, U' h simple.LoadModel("C:\\Models\\Test.spp");
2 Y" l. I/ b: |; T# R4 Z}
, h% b+ @( v9 l- J7 N7 Wcatch (e) 5 o) J/ \9 e- l
{ # ~( k$ c0 C( t v) o! z
WScript.Echo("Could not load Model!");
6 b0 k9 C: b- i- N( Y WScript.Quit();
* [5 E) X9 c f7 Z) V+ @2 y: N" h} 4 B4 O% S$ w6 V* c* N; a7 P% ]
" a( `2 x% G8 t( p
try
; D8 L4 e1 U1 k; Q5 I* U{
2 H" E& w; B8 y; J# D# }+ H' ` simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 9 P7 @" i5 k+ _; t0 }
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 0 F; [) O( {3 e' |) f
if (r == vbCancel)
& @1 I( |8 M4 n# m {
- q3 [1 j" L) ]* @/ {/ b" n8 K" O simple.CloseModel();
7 Y7 i* S. j7 {- d4 c D WScript.Quit(); ; S) I0 W) P& D- {% M
} ' t. q# L1 \! v! n& R
} + I7 p/ E5 G# r" w$ B9 y! L; A+ t
! @1 ]$ f, M! P7 j$ m# K
simple.StartSimulation(".Models.Frame.EventController");
% v u w$ m* L% X2 M# U, z
9 F0 d+ @6 Z' D8 ^ J" l& |if (simple.IsSimulationRunning())
( m% B4 S, d4 J& y2 ? WScript.Echo("Simulation is running!"); 0 I) f' I9 S4 g9 o- u; F0 v
- s$ ~2 T/ Q2 E( Q {; x// Wait until simulation is finished 8 r. g" z( P3 d5 U9 z2 ~
while (!Finished) WScript.Sleep(2000); 6 I, u) s% H/ M/ Y( m8 j
% l, f- s* N$ @9 ysimple.CloseModel();
5 W0 r* f* p) P" v% i# ^! Usimple.Quit(); ' H9 d- h7 y( i+ ~- j, x
WScript.Quit(); : E3 [7 p# }1 b; s' n+ ?# c
* z1 t+ ~5 k3 c
& y: R) Z+ \* W$ |function RemoteControl_SimulationFinished() / Y) x0 w6 `* g3 [7 c
{
. t$ ]7 c, V3 l/ e* } WScript.Echo("Simulation Finished!"); |