Example of a JScript ; d: m" |3 o6 f- X; \
var vbOKCancel = 1; 4 m2 O( N2 ]1 z9 I
var vbCancel = 2; 5 S" R! h( s, _
var vbInformation = 64;
' o6 P9 Z" f% C: r; ~1 p9 qvar Finished=false; . Y( I; `0 f/ `' x. X8 c' g8 \3 A
9 R* |/ G0 K# z( x
var WSHShell = new ActiveXObject("WScript.Shell"); 5 x& i3 s; L! o, S! w' Z
* o/ L. Y8 e: d1 S% e& `var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
: {; z. M* ~. l' v; b( L0 k 0 H' C0 A& m1 ?# d' _* p/ o1 _
simple.SetLicenseType("Runtime");
8 ~! a* K, Y8 P 8 |) f% V: J: `, W* F& [
try
+ T2 E; c5 _; ]% w1 u3 O, p5 r{
; ]: \; B* d* O, q // Enter the path to a model file! - O4 S1 T1 K1 p& I9 p
simple.LoadModel("C:\\Models\\Test.spp");
0 x1 D% U f0 m5 A}
( N" J. U- s% J9 [; L4 Rcatch (e)
- O+ @; v0 |3 @2 F, c/ A{
: k$ L& ^, D0 }1 P E* w. r: Z, O WScript.Echo("Could not load Model!"); % Q8 w" _0 O" n2 ?
WScript.Quit(); * U+ O# p ^3 o6 ~3 u
}
# B" _: p" Y; G" t8 c! X1 _$ K- A ! _2 N( @. ~5 g
try % n: q. h G. Z) q% G2 h
{ ; `) s! V4 _! [* F
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ( H7 n: l, [# U- m
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); . G" n$ m Q9 T5 b: D5 B, A6 u9 `
if (r == vbCancel) : a: I4 J5 U0 L, n/ p! z
{
! h; t" Z( E0 B7 X simple.CloseModel();
. v$ S) l+ Y6 |9 v L3 ?8 Z WScript.Quit(); 6 @( K# s, k' }4 Q- v4 {5 t& s
}
4 V' z5 C" E. T2 U5 ~8 Q- j5 z* Y) v}
1 E; n9 }6 A: U$ e 0 X. ~2 ]% ?6 M5 t6 |8 D8 D
simple.StartSimulation(".Models.Frame.EventController");
2 j0 B% [/ _$ w: `# r ) [7 J b* E8 [9 M0 p( O
if (simple.IsSimulationRunning()) # f4 H1 n/ Z& C
WScript.Echo("Simulation is running!"); 8 D& R( k4 Z2 a8 q. t
W( N# B) W& T7 Q; \( L; D; X! e
// Wait until simulation is finished
* T. F1 F0 K! V% Pwhile (!Finished) WScript.Sleep(2000);
* N) O! j# p% R1 o; C
& d- I- z, o1 N0 T, G( s7 O0 x( ^ {. isimple.CloseModel(); " L& \' N: G5 V+ v' B& H
simple.Quit();
7 `7 R" P' Z3 ?, ~) J9 VWScript.Quit();
0 ]- y6 i, G! |- r
8 `+ A* `7 U: a# F% G& Z5 {, O) A4 b
^$ t9 B; Z* W) Ifunction RemoteControl_SimulationFinished()
$ L5 B& P. b6 Y* A8 r f7 c/ l0 i5 w{
C& [: M+ J7 R WScript.Echo("Simulation Finished!"); |