Example of a JScript , [* m% [& Y. ]6 s- d) q+ W! o) v
var vbOKCancel = 1; 2 o* w8 D) ~7 j/ p
var vbCancel = 2;
$ Q: ~$ i5 x! P, O/ K% B, ^var vbInformation = 64; % d$ _1 a3 C5 `! t5 g: {. f) T* t' n" f) e
var Finished=false;
# r6 n& J: n' ^4 x% N8 O4 a ; j; I3 g" ?5 t2 a* c" x
var WSHShell = new ActiveXObject("WScript.Shell");
% `7 [) ?' f+ K% W( l" w. D/ u. R
' ]$ N. p, ~, Xvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
4 F% B7 W4 o" t) @# ^% n+ z1 _
3 G) s# V5 v3 Y4 o0 ysimple.SetLicenseType("Runtime");
" `7 |0 p8 }. H. m 2 `4 |! |1 y' {. ~% i
try
' |% H1 j% z! A! P6 V N. e{
1 B5 p/ O$ w+ v5 f7 z // Enter the path to a model file! : Q( r* L2 o/ H( S9 j
simple.LoadModel("C:\\Models\\Test.spp");
$ B5 p, ^* B* _3 J: Q! p7 `} 0 V2 S* C. l1 N" f$ A
catch (e)
; \2 Z/ |. F9 s- L ?1 |4 R6 Z- D{
4 ~8 R+ S) y# m7 a WScript.Echo("Could not load Model!");
; E, R& s2 e) H) r/ f4 p, Q WScript.Quit();
3 V7 Y" W. ^5 j1 O} + g) V5 j4 G6 o) X1 Z( A
9 S- Y* u) q" O
try 7 e( o4 L! o: o% s- s
{ 1 z4 T5 e5 c% H7 h$ _
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
6 w L6 M7 t. l r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 3 G! n- t) x3 n/ l9 a% o, C; B% L
if (r == vbCancel)
: g( R9 ~% M* c {
2 {' u( h, I, T$ p5 X simple.CloseModel(); 5 i9 u" x6 O+ }/ K+ R) R, D$ h
WScript.Quit();
6 I( ^& Z1 ?6 w6 E' ^! O- | }
# ^* ]8 o9 t0 w+ E F$ t} + M( p8 u$ A2 F' e
2 u# u0 v6 X7 N- V+ @1 Fsimple.StartSimulation(".Models.Frame.EventController");
1 i7 R8 \* O/ P3 i' A$ m5 N% q5 [. |3 B" ?
7 J/ y* N1 V. n9 sif (simple.IsSimulationRunning())
# p6 F8 b# h! L: U/ ~0 b WScript.Echo("Simulation is running!"); , @4 j8 A4 b4 w ^+ I- Q
9 D1 p8 t$ G1 R2 `// Wait until simulation is finished
* S" \+ Z# M3 _7 I, \while (!Finished) WScript.Sleep(2000); 2 Q; r) G" x. }6 w- U- A) N
( \- S7 p) L0 w: G! j: ksimple.CloseModel();
: n+ M9 @+ K% Y3 q& L+ d' |# Ysimple.Quit(); / }2 g8 C, q s' a" S8 S
WScript.Quit(); 4 `# O/ M0 f2 F z1 f
9 Y4 |6 H4 ]) [; A 0 l9 x0 e( r' r
function RemoteControl_SimulationFinished()
0 s( k1 s' [- H9 w4 @% w7 I{ o5 ^( Z) v0 n& P2 E% S
WScript.Echo("Simulation Finished!"); |