Example of a JScript 1 H6 r) u/ p& n p& V+ P& N6 s( R
var vbOKCancel = 1;
; r# N) o. a* {8 S: [- K2 Q( xvar vbCancel = 2; 1 P6 t+ `% Z: d( f1 N6 F1 x
var vbInformation = 64;
. e5 B! V" t. Q$ G: Dvar Finished=false;
1 U9 K' W6 A: e $ J. I: g/ b. z4 s) X
var WSHShell = new ActiveXObject("WScript.Shell"); ( S( V0 w1 _) g
6 A, _( h% U) ^* @. r( |var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
. c& k) _) X0 v+ y
* X+ O% I- W' q3 `simple.SetLicenseType("Runtime"); ) s, e z* Q; z+ B
0 J0 e% [% e0 N6 e/ u+ ^- r
try . r; G- ^; d1 ]- z) p$ M
{ 9 j5 C, d) H9 b/ H! \
// Enter the path to a model file!
& i- v8 D2 V8 O5 t. o6 t0 ] simple.LoadModel("C:\\Models\\Test.spp"); " i$ m# ~6 g! `5 s
} y0 m6 x% L" Q: {" n" J# K% X) E
catch (e) ' n! F- }8 H! `) [' Z' ~, S" |3 o
{
" r- @7 R$ V& p4 K! t' P WScript.Echo("Could not load Model!");
6 W( q" ~6 T9 D WScript.Quit(); 9 Y, G2 {! X: [
} X* c) P5 f& |! K
/ |) q% l( P2 ]! Ltry . d" S) ~; i" i- N
{
, m9 K" |4 u4 `4 x$ c8 x simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
/ G( W) ~! B3 a4 C2 ~: f0 F r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
, Y5 N+ d2 F6 b% _9 j if (r == vbCancel)
/ ^6 r ]3 s- R { $ {6 k5 Y+ R. `" p# \
simple.CloseModel(); - s5 Z- v! r, P1 |) f0 L( B
WScript.Quit(); . Q/ a; c! R W! {
}
. {/ ?7 H) x- @3 P3 b}
7 B2 B) i! \# w, ^/ _, |& U' I' y" g @% J. T) J y. ^
simple.StartSimulation(".Models.Frame.EventController"); & V) N7 G+ L, t7 B
) l8 Y# k8 T8 H. ~, Mif (simple.IsSimulationRunning()) 6 z7 g; R% v% `7 |0 ~' u z ?8 P
WScript.Echo("Simulation is running!"); ( ~# m9 u; z2 N0 P
+ o7 p* j5 S# Z* t* V
// Wait until simulation is finished
. s$ @ L8 ]' A( Ywhile (!Finished) WScript.Sleep(2000); ; `" H/ @5 ]' l
$ a, ?# x: _" [' O5 W
simple.CloseModel(); : d$ @3 u, G0 G1 s, _) `. c& a
simple.Quit();
- w5 u0 |2 E6 @8 m$ WWScript.Quit(); ' Z# m! O! q) R; P) E
5 _) Y6 i3 P( W/ F9 m; C
; q+ Y$ k/ z" A: d- ifunction RemoteControl_SimulationFinished()
* q9 k6 Z7 q' X, ?9 o6 I8 ~4 `{ & e* ~4 v- G8 H: o
WScript.Echo("Simulation Finished!"); |