Example of a JScript
7 w4 A0 U. O4 v- U' Jvar vbOKCancel = 1; ' Y6 Q+ e$ U$ t) R* n2 [/ H
var vbCancel = 2;
3 p F, i; b3 |6 a( Pvar vbInformation = 64; 3 N5 p2 P! M6 F, ^5 u1 }7 n
var Finished=false;
. m7 D6 X+ X2 l$ a
+ X0 @; M; f) ]/ @2 v' Vvar WSHShell = new ActiveXObject("WScript.Shell");
3 l& e4 {8 j! Q6 w- G4 C: \ * b: O6 J/ y% [ h
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
9 Z9 N; _3 O, y5 n& V2 {
1 z l1 y) Q3 L) ksimple.SetLicenseType("Runtime"); n$ ?6 m+ p0 P2 K. \
; f$ x: O& o) Q( Q D
try ! C8 L0 }5 w4 E' U9 p2 s9 i
{ + [- f) W D6 h" N# [1 ^. |5 t
// Enter the path to a model file!
5 t) ?6 N3 z: a& T, v simple.LoadModel("C:\\Models\\Test.spp"); 9 \8 ]( i- [9 r" |5 q' }
} 5 Y% n+ U; j9 E; ~' a
catch (e) 9 Q/ o4 o k1 G9 }3 G2 A+ N
{
! l' t2 q; ?' J0 g$ \6 C" R0 n$ u7 I WScript.Echo("Could not load Model!");
& [% z. A! ~" z; A% q1 q! { WScript.Quit();
2 A" Z& o& X, C; [$ ]. P* G} ( q" t" j, r* ~3 D; t
' W1 X: U/ o/ t) H- b# b# ntry
6 F# ^ v( L9 B- Y P{
0 r8 G( k& E) s b4 Y0 s7 t simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 2 x5 y6 U4 b- ~+ k; l( Z; Z
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); , c0 Y. n% ^/ X* y# N7 [+ a
if (r == vbCancel)
& p, a: T& L# D4 ?8 m% r { 1 w, U* s9 B& ~+ y I
simple.CloseModel(); ; F; a: ]7 J$ b R6 k
WScript.Quit(); + Z' t. P4 A% m* b7 b! `
}
+ t: X& a8 _4 z4 Q: A}
7 v) C% f. b0 O, T$ w& `
3 F- j* \2 L2 s4 msimple.StartSimulation(".Models.Frame.EventController"); 8 L2 D7 n' @/ D8 K& s2 O+ m) M
) \1 D, u ]$ Z( T
if (simple.IsSimulationRunning())
! J$ K- l& k2 s3 L j8 M$ I. d, e WScript.Echo("Simulation is running!");
/ H5 B5 t4 a5 E) x+ V 4 }* F" q6 A# J2 ^, D1 d9 b5 @
// Wait until simulation is finished / g2 T. D# T" S4 p& l
while (!Finished) WScript.Sleep(2000); . \( c& E5 S) s. z& Z( P$ C* C# h
7 G v9 | W4 h) {* _4 c5 J& ]
simple.CloseModel(); 3 A& _9 ^ @- @6 x+ o+ i' d! P
simple.Quit();
; Z6 y# U! l, R+ |WScript.Quit();
' ?6 d6 t; D! E) u. {1 m$ g- x
2 H% v& R- E) u
0 h- ]4 A7 n _' |2 ~) ~function RemoteControl_SimulationFinished() 5 a" z: {- f# t+ Q
{ : m6 r, \' _% D+ d4 T5 p" y% E( [
WScript.Echo("Simulation Finished!"); |