Example of a JScript - m% I; b& R( F" l! s6 D6 t
var vbOKCancel = 1;
9 `8 i* \" v* Y* y5 ^4 Pvar vbCancel = 2; 2 G9 N3 Q0 Q0 |, ]3 e: c: A c
var vbInformation = 64; ) C7 A0 ], y7 a* B8 u& ]& b
var Finished=false; 1 A8 U' p+ n- w0 `1 n, f
1 Z1 G" Q2 M8 T- p7 I4 X
var WSHShell = new ActiveXObject("WScript.Shell"); 4 `. K4 a' v! e- N. {, r
" w, I& l, V0 x8 ]$ ` k& z
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
! F. A) J1 P* g" x3 }* v + s' W/ }7 t" ?+ ^
simple.SetLicenseType("Runtime");
. z. p: a1 |8 X8 k) w$ N! I7 T
5 t. q3 x* j9 `* W+ Itry
7 \9 m s' U5 k# d0 J" O0 P* t; W9 Y{ ) i5 L' t5 |) D8 o* \8 G
// Enter the path to a model file! " R: M0 d5 u7 l4 p g
simple.LoadModel("C:\\Models\\Test.spp");
" O# `" m( U6 b0 F! L} G* B3 a; {0 S7 s; E
catch (e)
0 e8 g# ]; ~/ Q7 c- o{
8 e3 X, w. }% T X WScript.Echo("Could not load Model!"); 6 r% c2 W4 T. e& ?! f
WScript.Quit();
8 \. k$ `. c* s; M1 [}
7 T; d9 Q! B; ]: E! {7 R0 h 2 f1 {. a* Z) q5 q T+ h% n
try 4 A! Z7 l* K7 \% J0 R7 R2 W
{ : w- k! j) k* o( o5 U
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { . t7 c- q% l! q+ ~% S) q! r+ s
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); $ q' d9 Z2 g1 S6 U5 u
if (r == vbCancel)
* `% G0 c( n: g& g2 X9 s$ |/ L' U. \ { , a# @' y6 z1 V0 T- M
simple.CloseModel();
' O' i2 q& O8 K+ L WScript.Quit();
7 |" d) D6 ]# ?2 @ } 2 [3 p: E/ P' V, a |; d' `
} 8 o$ ~; y$ S' O; t* v. F# N
1 k; O+ U- ^6 @$ x% c5 \9 C0 t5 L: Gsimple.StartSimulation(".Models.Frame.EventController"); ) o0 {+ u% y/ @* v* X
3 [7 N: a" y' r4 o# mif (simple.IsSimulationRunning())
D: H) {/ z) M& y& W% }1 { WScript.Echo("Simulation is running!"); : z3 G" W+ q3 M, s, t) |2 y
" `3 L$ |0 n: J- R2 @! {// Wait until simulation is finished - \: d6 s! j9 @! N3 a# U
while (!Finished) WScript.Sleep(2000); : D t7 `2 S1 l7 w' G6 g% O
; a) C2 G$ D6 ~6 }7 W
simple.CloseModel();
( j) L9 M, \; e/ L; Rsimple.Quit(); 4 R. c3 g$ ~! ^9 u& ?* [: d ~
WScript.Quit();
# q( Y/ T, q' Q6 {
0 z( s7 r6 j$ w- `1 R4 ~, x # H% C: Q# Z; [6 a/ F
function RemoteControl_SimulationFinished() / u+ t! x% G/ P% J2 W0 p( O
{
5 o" s0 p) E% G! m WScript.Echo("Simulation Finished!"); |