Example of a JScript
* j- ~% J+ [ M9 bvar vbOKCancel = 1;
+ b5 t: M5 O7 ~) b5 ?var vbCancel = 2;
1 i4 |3 g( p& n; f4 H3 _! Avar vbInformation = 64;
9 S @# o: ^% [' F' L4 _var Finished=false;
# Q5 g2 f# `3 P# Y7 L% T * h* o+ o7 E$ E
var WSHShell = new ActiveXObject("WScript.Shell"); W3 d e8 n" w$ T( t( T
- `! g: t( v- q7 z5 L8 V' z
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ( O4 w2 ~/ @6 n4 x4 h
9 r# X0 }8 r- ]( u
simple.SetLicenseType("Runtime");
; S! O& t$ v0 |& e1 V
T6 Q' J3 ^, P" l* }2 `try
, t$ b( m" }/ J1 b8 j{ k v" @ g% S, M
// Enter the path to a model file!
6 h( V) A1 \! N0 k simple.LoadModel("C:\\Models\\Test.spp"); 4 [4 s9 n) e, a- w3 }- Q2 t% O$ n
}
& n6 \+ F, U7 s5 W" \) fcatch (e) / ^) j2 }4 c- c8 B7 k
{
6 X9 g# x0 ^6 ?! { WScript.Echo("Could not load Model!"); / f1 h: T9 u8 m( t: I+ d" t
WScript.Quit(); 7 C) v% _ x; ?8 G, e
} 0 r( J4 z7 q2 P" z8 D
7 T: N& q8 J8 I( N0 ^' }9 n
try
( T5 r7 z! Y7 @( \8 O% d{ ! H& U; t, p9 k: P$ x: g. r+ b
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { + {; K' ^, y& e' n! Z1 y# H
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 9 t, L1 Y* n, A# m% b6 Y# Y* D
if (r == vbCancel) , i) [) w! {0 O0 T5 c( E) x; N! [; {( i2 I
{
( A' a; q& x$ \ V simple.CloseModel();
1 w1 l2 ~- Q; s7 O WScript.Quit();
) J1 V5 V# a+ o% t3 @( j }
0 F' B5 m8 R. D0 ]& Y}
2 g9 i, u5 @9 y* @4 x @* A5 A$ w w; N( m8 F
simple.StartSimulation(".Models.Frame.EventController");
X, a! Z8 I, O, M) r& i& g 7 Q5 v2 m# k8 q2 t
if (simple.IsSimulationRunning()) ) _# i6 ^4 L# b% q
WScript.Echo("Simulation is running!");
6 \ V! P( _0 N" o
& z" l6 t: h- |4 Q2 `0 m// Wait until simulation is finished
0 ~$ L1 F i8 I2 [while (!Finished) WScript.Sleep(2000); " t; O. M4 j) b& y) p" O! i
, F0 t. D |6 G6 d
simple.CloseModel();
) f- T- t! i5 A6 b- s8 qsimple.Quit(); ; Q* t0 L& x/ z4 Y! I- P
WScript.Quit();
, c4 u' c1 C2 J
5 n1 x" P- ^* ^) {4 I
D, @, `) W, z2 {! f8 Ffunction RemoteControl_SimulationFinished()
+ ?1 l1 q. i1 `{ : ?1 X1 _( c+ p) f# }& `
WScript.Echo("Simulation Finished!"); |