Example of a JScript 2 R& |5 |. }# d! n( K$ F
var vbOKCancel = 1; : }! Z/ t, K0 d: }
var vbCancel = 2;
0 l* k% h$ q: z9 E7 F% P# X1 Cvar vbInformation = 64; 0 t( W4 i+ B, l8 L5 c: u
var Finished=false; + I H5 r7 A5 v9 x& c$ \# O8 s
0 }% Q9 k2 ~# ^/ t. }5 z, W2 L
var WSHShell = new ActiveXObject("WScript.Shell"); " W& }2 _% q% ^. ~
" s7 ~+ G4 z) P6 x7 ^var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
' T9 b: ^! z9 a L7 w& `& T8 ^0 _
simple.SetLicenseType("Runtime"); ' L2 p( L3 [, p) ?0 r# h8 g% D
/ F4 f9 ^7 C0 L3 s. ~7 D( k2 g
try
# D# V2 K. v' U{ ' u+ c+ ^: A- T9 i
// Enter the path to a model file! 7 s8 U$ a2 t+ j T. D) r& B6 r
simple.LoadModel("C:\\Models\\Test.spp"); + f+ L1 U& i Q* n" Y0 b% Y
}
( b# ^/ M' V) R. _catch (e)
3 H: h6 |) O! N/ S8 Y2 W3 B' `{ 0 r( ~7 n6 I/ w9 t* l/ s8 c
WScript.Echo("Could not load Model!"); - Z! L3 v D1 F9 I' K U
WScript.Quit(); 4 x+ N! w& r7 T+ q
}
% w' T: x9 D& F! w+ [ D& U3 |
9 S6 `! h d8 O' Qtry
4 v; b0 r& A% C$ h! _{
; \4 @- F6 Z5 y& q9 Y' O simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { % C4 G* j6 ~6 `/ p( o& ~! F0 T- T/ o
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 2 B8 f. I0 Y) _; C4 [
if (r == vbCancel)
% c1 Y/ j- e* M; k2 u6 `5 U, v7 l { - X7 p* y2 G4 j6 w) u. G; c. Q/ n5 i
simple.CloseModel(); $ G% l, w x7 H
WScript.Quit(); + b2 c7 o: f" J( i6 l
}
5 C2 n& `+ E) S% E: I" m}
( m+ F+ x1 Z# a- L7 y) m
+ D# A7 Q: | \' I4 Y) k; I! ssimple.StartSimulation(".Models.Frame.EventController"); 4 N. S/ [" ^0 r
7 J% x) X: V7 N0 L8 Z+ Oif (simple.IsSimulationRunning()) 5 n3 Y8 r- f; |8 T' l3 y% ~) P5 O
WScript.Echo("Simulation is running!");
. o. O% c1 u7 x( N( {" I
1 x7 `1 ~+ f! z. Y) i& m// Wait until simulation is finished ) n) A2 c4 z8 H- [- q" [. R
while (!Finished) WScript.Sleep(2000); , `0 F* x; s9 G7 j2 Q, C% G1 u
5 A8 _4 z; l* }$ _; w8 T
simple.CloseModel();
; p$ l6 o9 A5 [9 V/ ~, n* jsimple.Quit();
( G) C' x$ R* B2 P4 [WScript.Quit(); a1 D: _% N' M) z9 \% h
: q8 Z5 T+ h4 f, |0 N' h N0 K( l$ B . d# Q; M4 `1 D2 R0 r) M
function RemoteControl_SimulationFinished()
* |9 s8 r( X V% ?2 g6 |" s{ 6 Y1 F' D1 Z& o8 ]2 A
WScript.Echo("Simulation Finished!"); |