Example of a JScript ( v/ S' S" R- R) b, c( P) Z
var vbOKCancel = 1; 1 J( v w! m/ `
var vbCancel = 2; " n( b# j' [3 w1 q2 g
var vbInformation = 64;
: N5 p3 [ y" ^! Q' z# M. Qvar Finished=false;
4 |$ k+ s5 o: ^3 ~1 T9 ]/ R5 @( u 4 t5 ~2 y. ]! c: B5 Q
var WSHShell = new ActiveXObject("WScript.Shell"); - h& H4 g8 |& Y3 R. `
. j% y0 d2 D; g9 S" ^5 t- ?
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); . T7 R, e# w N; c; @
* c7 V w# z. a5 @simple.SetLicenseType("Runtime"); ; t$ H9 j5 X6 v5 a$ Z+ b
. U) \/ E; e/ h( P& S) D
try 3 L2 P0 o3 ^9 k6 O& _7 x. @
{ 2 u; S6 F/ U9 w5 q5 A
// Enter the path to a model file! % t5 x# p: e, o L4 h" h7 }8 ?0 o0 a
simple.LoadModel("C:\\Models\\Test.spp");
1 |) I/ B" R; A+ L} , S. \1 h6 c$ o) j; K
catch (e)
% a1 b1 R; L- b; b{
) c6 H" I- T2 A' L% r6 } WScript.Echo("Could not load Model!");
( u2 M1 E& U; h# z i6 O, N5 | WScript.Quit();
1 R: k: C# M% U, i( h} ; i4 I& A/ T: |8 C
; I, I+ n. o* _7 Z% ~4 y
try
; J5 J8 S$ N' K3 L1 A{ ; Z1 D2 @" W3 U% _; X; I3 C
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
* ^& n6 v7 A* r& [: }: h3 C6 f) l2 l, s r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); $ G, F: B) L5 }2 f! H, H# j; A
if (r == vbCancel) & P" A7 h' d4 r, u3 l+ i' e: z; [( o
{
! _" w7 f& l' y9 V. g simple.CloseModel(); 5 y0 y6 c/ S5 B- C- E
WScript.Quit();
5 H5 I. Z8 S* s }
" b) U& Y* @3 E5 E' H2 o/ @# u3 V}
- I7 L* y1 W$ H" r# E
8 ]6 J: r5 N& O7 s5 r. k0 hsimple.StartSimulation(".Models.Frame.EventController");
% m8 [1 f b; Y) U- v# ] % N; I: s+ c( `
if (simple.IsSimulationRunning()) , y4 [* J; N1 T! [8 k
WScript.Echo("Simulation is running!"); 1 [) H2 Z% W& C4 ?) ?/ |
, F V5 h% \- ^, \
// Wait until simulation is finished 9 r5 c. ` U: s5 W! s; R
while (!Finished) WScript.Sleep(2000); , ]! s- _/ O+ C$ A
% l0 F+ Y& U5 K8 n4 usimple.CloseModel(); ! X7 P1 j7 r- W: Q# z# `
simple.Quit(); 0 x+ K- i9 O% b- a
WScript.Quit();
+ `5 K2 | W# O1 S; [9 ?9 |8 y
4 H5 |* a4 c, O ; t+ D& d: |% q6 b+ {0 X# c8 W: h
function RemoteControl_SimulationFinished() 8 Y/ y( A2 L/ n" h( U
{
+ K& ~) H; s( d% | WScript.Echo("Simulation Finished!"); |