Example of a JScript ) ] g# N, T2 @
var vbOKCancel = 1;
: e) h: l. z4 j% ~ z! uvar vbCancel = 2;
# @ ]$ d# o3 H" W) Svar vbInformation = 64; : s4 X: v0 E* j5 d9 o8 Y! \- s
var Finished=false;
- O) E, p/ b; m+ O q
& m, E; y! L& U" t/ evar WSHShell = new ActiveXObject("WScript.Shell"); " t7 O/ O: i/ f
; |8 g( u# [# D- W8 F# } ^
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
+ s# {! N+ _. X% B# g1 j
( B: _ E Q/ F' Z3 dsimple.SetLicenseType("Runtime");
; u8 w' _: U* S0 n+ u
4 d% M2 v8 J+ W0 j4 P9 X7 G. z: jtry
# J% Z _8 A% Z/ U/ W; [{ " {0 f3 q& D. p
// Enter the path to a model file!
\% b; G- P- i simple.LoadModel("C:\\Models\\Test.spp"); 5 B! ~( t* y U" M7 M4 `
}
( ~% o5 M2 M$ J! k E- \1 Icatch (e) : v. V8 ?9 f5 ]% R1 y
{ 0 T3 |- ^9 X4 o8 M- n, n/ y, }$ d
WScript.Echo("Could not load Model!");
+ q5 ?; F7 j* J1 Z+ |! w5 ?" D WScript.Quit();
9 |2 q* S1 T) l9 g' h: \; q# f} % I( D. Z) e: E; p! c- m d
+ a" W5 x1 R4 c8 H7 |
try % a6 _, ?& P, S, ?9 M3 u
{ 2 L$ V8 X: `: o' _' [1 R: V; I
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
/ M+ r! w' f; G; i r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
/ h( o8 {1 x$ F; ~" J; L if (r == vbCancel)
0 R# d! J2 i1 i9 G3 M {
& t3 n: M) {" i( j simple.CloseModel(); 7 k7 K+ |# r3 L: m
WScript.Quit();
; a- T* r" _% `3 M8 } } 4 Z& O0 y$ E+ _
} 3 K1 z* B/ A' i% Z- l9 o/ |
8 }/ ]4 i7 G! |5 r, a* n. vsimple.StartSimulation(".Models.Frame.EventController");
{/ {! q, ]: f" W7 N$ s2 T0 k
: t# x9 z# c; ]if (simple.IsSimulationRunning()) 4 j7 A7 t4 `$ `$ c+ i
WScript.Echo("Simulation is running!"); # x3 ?, y. K) D: W. ~; I% a
$ }% }1 ~! I4 s0 p' ~' d4 L1 o; [# `// Wait until simulation is finished
+ p. x R; e0 N7 e0 T( P% F* y6 nwhile (!Finished) WScript.Sleep(2000); / m* X8 ^3 E9 V8 f. Y
7 G* j+ }1 i' l8 `. h
simple.CloseModel();
+ \; M. A) }7 R) l/ Y, Osimple.Quit(); % v$ i5 J; E1 I ~% L- B
WScript.Quit();
$ I- D' V& N2 k7 s
* w/ ~2 B9 b, L7 Q) S$ m
1 v) O9 G( G; u6 Ifunction RemoteControl_SimulationFinished()
8 n/ S* p7 a {. E4 | A2 H{ $ b+ m% \" G# c1 b- x w9 ]
WScript.Echo("Simulation Finished!"); |