Example of a JScript
$ E7 ]' f' d3 X4 b( \4 y. svar vbOKCancel = 1; / n+ B' s6 v8 d9 f
var vbCancel = 2; 7 X B* v( t1 L( l( z" C+ w
var vbInformation = 64; ' y1 X8 [0 A; q4 h! G8 C
var Finished=false;
# F1 d/ m6 k7 K7 `1 F1 d" N
- G) K0 Z- q5 E) x: Nvar WSHShell = new ActiveXObject("WScript.Shell");
; x, g8 Q/ z- O! j
4 w- F* X. h) o6 _6 Tvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ' n9 D+ A% x7 M" [7 u' y) k* u. e
. q& g3 A0 C, }$ K( K; d x+ j* Isimple.SetLicenseType("Runtime"); ( W8 l8 ]8 a1 d/ y3 D* L ^2 |( k5 a
6 U+ p3 a' J7 d" j. D/ o. j% [
try 1 R! P$ V) ]% P7 a3 q5 M
{
& H6 Z7 p$ J5 K; f2 o' Q$ i // Enter the path to a model file! 5 F+ j' v6 f& C) r! |& S7 s( ^
simple.LoadModel("C:\\Models\\Test.spp");
# ]! ^1 c% v D, f& V: C7 G3 ~4 S} ; [8 `+ k J: a& L
catch (e)
% y2 i5 |( t6 Z) }6 f8 x I{
, I3 U$ p! r l1 E WScript.Echo("Could not load Model!");
0 H3 e6 q! g# `" V# p+ U8 f2 |) g WScript.Quit(); 0 T- V0 U# N2 w% O; r
} % R( _( {' H/ d4 [5 u
% q. ~& U0 [6 l7 k7 n; {# |) m' y; d
try % @9 p. _8 d4 N
{ / Z z, {0 C4 T3 d1 U
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { , ]1 D1 x- W3 ?4 x6 `& H2 `# M5 b
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
2 s0 {0 b- r, _0 {/ c6 c, [ if (r == vbCancel) 4 w, `/ ~6 y2 _
{ 6 ^9 M, R/ I. q. E# x' @
simple.CloseModel();
' L* M+ _ Q, }- ^. F8 ^% P WScript.Quit();
6 J! D! X: X, C) V4 L1 } k; z/ [' q/ p } . e+ _: o* ^; F6 e% A
}
" j8 V+ m7 L+ h8 ]* k {
$ j( E) v: U- }! J" jsimple.StartSimulation(".Models.Frame.EventController");
# C; y) O: U9 k7 {0 `
; L5 P) h/ ]' R1 \" Wif (simple.IsSimulationRunning())
! m1 r& E6 b* I WScript.Echo("Simulation is running!"); ) J V6 _3 ~: }) _
- s: [+ l; R4 E2 M" C* s* b// Wait until simulation is finished
! }, z. P: x2 G+ h0 ^5 ywhile (!Finished) WScript.Sleep(2000);
+ p3 B) l: p6 n! \ ' f+ N! c, s- E" h/ w# K4 f
simple.CloseModel(); . W% B( b- e. e1 g6 S
simple.Quit();
; Q, S+ [4 V! y& O8 n+ ]. {' ?WScript.Quit();
; K8 p4 o$ }/ { ]5 V
6 j8 h( L$ K( | }( I2 ?2 e: t0 M
2 H2 w# f: h& U8 f- e5 Pfunction RemoteControl_SimulationFinished()
6 d3 V* ?: o! J' v& b{ " }7 _, |5 B a" v% r( r
WScript.Echo("Simulation Finished!"); |