Example of a JScript
$ G6 B* b9 O4 u1 Gvar vbOKCancel = 1; 8 c$ v/ l- b9 U) J
var vbCancel = 2; + k. r3 L O4 `: N
var vbInformation = 64;
' i: |" Z8 F6 N+ O7 B) Q1 [ y& zvar Finished=false; + W" Y8 ~6 H, [5 w& q
+ h0 Q S" s+ I+ b& J0 ^
var WSHShell = new ActiveXObject("WScript.Shell");
. }4 j8 K3 A. |, ` Y; `, [ / a' j" r4 }* x
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); $ h! a7 }! W1 o
0 N) C3 D& N4 F* Q7 U Usimple.SetLicenseType("Runtime"); 7 ^; L% a& R+ X* K/ Q; I9 \
- e) V2 z8 E. |( e* @
try
# o4 p* H* E7 J& P* M{
% f: J% E; V& \- V // Enter the path to a model file! ( O4 N) p9 S9 Z9 t( u! U
simple.LoadModel("C:\\Models\\Test.spp"); . B6 T' o+ s9 l F
} & i/ [( O) I( q# }$ h1 V
catch (e) 4 m" i3 A: [. T9 M
{ 4 X" P; U; A. s4 ~$ T; C
WScript.Echo("Could not load Model!"); / o9 s- K+ ~$ L% s5 t
WScript.Quit();
( N2 l% w9 i0 @2 I6 r C: Y+ M r}
! q2 c$ m" b6 r G
6 N7 H5 y4 x7 Q# e! l7 m1 wtry
/ d* M* X( a+ X0 j" I{ ! D* g8 ]8 u- O5 j% D, X( O
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
/ H2 ~2 e. u# M: |0 L0 c r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
, u ~& c' H0 G `2 E S if (r == vbCancel)
4 |/ F9 ~& F; _1 k: w0 I% w {
$ M1 ~$ g# i' X& L4 Z9 ` simple.CloseModel(); 7 v" m9 M, P X3 X6 G4 c1 V r
WScript.Quit();
9 d1 u c8 V1 M4 C, w! J } # a% s! O% |2 E5 Z/ y
}
/ s8 E/ B+ ~7 H7 ]: @) r' G5 T1 P & c& w4 _& d- a
simple.StartSimulation(".Models.Frame.EventController");
. S1 L) X- V4 E% {5 }
3 b! \/ g$ |' P$ F+ V( W" Yif (simple.IsSimulationRunning()) , Y2 i% @$ w8 o9 h
WScript.Echo("Simulation is running!"); 4 G1 g& F, ]2 x; y |
# R& n/ z2 n' u// Wait until simulation is finished
/ `* d& x& y& W! xwhile (!Finished) WScript.Sleep(2000);
3 @1 @2 y) C* U; M; f. a & {, T4 g5 v% M2 ^# J+ D% ], V
simple.CloseModel(); c+ g2 Z3 j3 @# `& {
simple.Quit();
' o0 m" V* R- C* @ EWScript.Quit(); ! |* Y1 L. D' q2 e0 D( T9 M( e: m
( e6 O7 U2 @( ` g
. k* l5 b; Q9 _, X0 @) U0 nfunction RemoteControl_SimulationFinished() 2 I6 C% w+ `; p- W. P6 x
{
9 t( Y5 s% A! a WScript.Echo("Simulation Finished!"); |