Example of a JScript
' x6 }0 q, i8 {8 jvar vbOKCancel = 1;
( z7 J! y& x4 jvar vbCancel = 2; 1 t. l" k. k1 N) L- ]. B3 K& w) ^
var vbInformation = 64;
7 t1 D1 _4 V6 u, R2 y& s5 ?' _var Finished=false;
; k0 z# C* \) e$ b8 A( ?# C
4 Z7 }. t/ `5 y4 a3 m/ v9 Ovar WSHShell = new ActiveXObject("WScript.Shell");
) I* N# ~: P4 z3 @7 V6 i
0 k4 u1 H5 ]+ y% I- avar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
" q" P- A0 x- A( y1 l / E8 F; S) M/ C, ?
simple.SetLicenseType("Runtime");
# S2 a$ i( ]' I+ C5 N0 G+ I ) q4 T" Q( n& x
try e& F- B8 a! R& V# q% B: b8 h" ~
{ 4 V3 J4 U9 k. A
// Enter the path to a model file!
- [7 F* [0 X( v* ~! T simple.LoadModel("C:\\Models\\Test.spp"); ) u/ |. [9 A {6 C* z6 T
} % b6 `; V8 X9 ]7 a5 Z( _
catch (e) " Y2 D& M4 Q8 Z8 T9 _6 u
{ 3 @7 w! a9 H Z# ?' t
WScript.Echo("Could not load Model!"); ! ?' v* o" F- D1 x' m2 m
WScript.Quit();
) Y3 B$ U' e' v9 N}
3 Z1 l4 _. h) c1 x8 U
# ~* e' J* } Otry
# O+ m0 A+ O8 h; k{ , V4 f( p( T% ^
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ ?7 ^) y( W6 f" @" _2 D' { r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); S5 j1 a& F! a! f
if (r == vbCancel) 0 `; v! Z5 V( H! Y1 J* O
{
5 E- n: k! l6 l8 O0 l, h simple.CloseModel(); ! K% U+ k9 I& f$ `
WScript.Quit(); ; |5 k; K) [" w. V; `, w+ I2 Z
}
- O( c1 c+ L+ D7 Z. s) H7 ~+ `} 7 ^) k9 b" p3 e* _* U
$ _9 H6 y J$ v% m: }simple.StartSimulation(".Models.Frame.EventController"); 2 D& K# _5 d( I
8 w9 _: S- R8 w8 vif (simple.IsSimulationRunning()) ' y# N* G; L$ _7 d O
WScript.Echo("Simulation is running!");
) `9 k+ u& a7 z A1 L, L; a0 ` 1 G* {% U+ b9 [0 e0 r1 r% p; d/ l
// Wait until simulation is finished " Y o8 @# f0 H$ U
while (!Finished) WScript.Sleep(2000); ) J4 A1 s8 n# x; o# q* `2 n
. n1 A* _: @; `simple.CloseModel(); : X% k% O6 R4 a8 m7 w9 h* c
simple.Quit();
\2 T. l4 m0 P" ?% {: uWScript.Quit(); 8 q& z+ X% [) x- q1 B3 B/ R
3 y7 w5 g9 w9 J2 j
3 a! K o1 c5 v% ^$ |8 d5 Afunction RemoteControl_SimulationFinished() . v, N6 H7 ?7 y
{ 7 ~9 D$ y. b* F8 q {
WScript.Echo("Simulation Finished!"); |