Example of a JScript
. T4 |$ q9 V* C* T8 u9 ^6 Lvar vbOKCancel = 1; ; l$ R6 h6 O; w5 V0 S8 ?% H" W
var vbCancel = 2; 6 s6 j7 N1 F: l
var vbInformation = 64;
; R4 W, {2 ?' J$ B( ^( Qvar Finished=false;
# z8 p N0 K8 I4 m
# k @ E5 e# R dvar WSHShell = new ActiveXObject("WScript.Shell");
) q/ A6 C8 j! r5 _
3 H! z1 ]8 x5 o/ D) b( vvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
' k' q: E1 ^, l! d' c" U3 T) ] " E( j. S0 p+ F. F
simple.SetLicenseType("Runtime");
6 d/ W v) W; t# q3 c* I
+ P5 e, A2 V" q' l) }. wtry
8 `% {" |' H- } p0 r# o, o% U{ + ~/ E! c) X7 S" K1 C
// Enter the path to a model file! ; B: F7 E6 F% J, s- ?! w
simple.LoadModel("C:\\Models\\Test.spp");
9 q4 d8 Z$ }* H" N+ Y} & V: H) B, A3 X: X; D
catch (e)
) y( ?# G6 n, o) S0 ?) F* J{ , _! e0 G: x. g
WScript.Echo("Could not load Model!"); 1 r: V0 t/ q w z9 {: C
WScript.Quit(); 3 f' v1 ?( n1 t% p
} , u4 h2 Q, L( a3 v
9 N U- T& h+ x, L5 p7 S
try # o) l+ G* O0 w
{ 9 G* O ~' J( r" H9 I1 `; K; C1 U: U
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
" }! D2 q; a1 y9 m+ I, X6 i r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); - y( L1 i' f9 P) D6 t( ^
if (r == vbCancel) ' }4 W& d# |1 s+ d9 @
{ l8 H- H; W- G8 A3 n4 c
simple.CloseModel();
5 s+ _6 ^. D9 l: z. ~4 i: O ~ WScript.Quit();
3 m! }4 E2 H7 x- K5 J7 u$ f } ' K) t$ c) W( @" m; d
} . D, N" x$ }) ?
" C# b5 L9 p# R a9 |
simple.StartSimulation(".Models.Frame.EventController");
( j4 o8 @( n( U: F6 Z3 l 6 U9 M% j: d" x9 ?4 s* z2 j4 X( H
if (simple.IsSimulationRunning())
/ y6 X5 s% L2 b$ s WScript.Echo("Simulation is running!");
# Z+ M# u. Y: l
2 J2 D' p/ ]8 w9 r& W// Wait until simulation is finished
8 Z, U# b" h+ `while (!Finished) WScript.Sleep(2000);
5 X9 M3 ]9 f1 G- N - a+ o$ j2 j" ]- y1 D2 }
simple.CloseModel(); : p( a5 h. Q2 q1 e
simple.Quit(); . O" }( m$ ]: ?, n- T
WScript.Quit(); / I+ B+ l3 P" ^5 ^" d4 H2 t$ w
3 X& _ V; N2 f7 e9 \. q; {9 j ; n# e1 d) N, j( b' J7 e6 p( T
function RemoteControl_SimulationFinished()
5 G& v% l) s! l" g{
( \- P& n d( L- ]; y1 l" { WScript.Echo("Simulation Finished!"); |