Example of a JScript
/ ]4 i3 d5 m2 O, o# l* |- Cvar vbOKCancel = 1;
4 J7 h+ I0 g' ?! P1 Lvar vbCancel = 2;
7 f/ x% C( i' ?1 N6 {1 hvar vbInformation = 64; H b5 [& F% V! C0 K7 e
var Finished=false;
) H8 F; ]' h6 s) K" S5 ]- d
& s6 p+ P4 W$ m4 ]* hvar WSHShell = new ActiveXObject("WScript.Shell");
7 E6 J6 W1 [9 b; A& X
$ i) C: C' V. fvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 8 }, ]+ N' b" K9 S: X
! B. [* Z" q$ c4 w& Z, }7 @( S( j
simple.SetLicenseType("Runtime");
2 t( U4 f/ D; D6 s) @" R 2 x! h s7 ~$ A
try ( u! @: t( [$ J1 t
{ + B: h9 F2 C( S j( f P+ s
// Enter the path to a model file!
% T+ P. p2 @$ ]0 Z5 P/ u simple.LoadModel("C:\\Models\\Test.spp"); ! t8 C) L$ g# [- u
} & [$ a! q" [+ y& ?
catch (e)
# {" u' X, L. H" C2 ^: Q: x% G{ * r6 K& q6 ~/ U g
WScript.Echo("Could not load Model!");
8 z0 h1 w9 Y! @% e, A7 m/ N7 Z WScript.Quit(); ; p4 P( J- h, u
}
! C1 ]: ]* S! f3 H) a 8 d Y' j/ Z+ ?1 D: B F* p6 R
try 7 ], s- ^' k& m( R: s# ?6 ]
{ 4 q8 ~- \5 M6 T
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { * c/ U, {( T: c" r
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 6 {* N) i1 C- P1 x& `* l8 H2 O
if (r == vbCancel) . n c0 L' ~& q6 Y: n+ Y
{ $ c5 D2 ^/ y, a# W. n) F
simple.CloseModel(); $ O2 e3 g' i6 x; n
WScript.Quit();
5 K$ i) n8 L: u) p+ }+ o, O9 B }
, L+ D. x' V8 t2 ~' o. I} / ?, [: v3 K9 y3 E3 ^: a: z
^% D3 f! w+ d, d; `& g$ |simple.StartSimulation(".Models.Frame.EventController"); . `. n. |; _1 U' G
- M. t. {" ^) V7 ~& X0 b, Jif (simple.IsSimulationRunning()) 6 {! X0 {' l6 i6 W: X
WScript.Echo("Simulation is running!");
8 p d7 e2 [( D& Q0 U% Q. V : K( m$ B9 _( k" y8 L/ c/ L* C
// Wait until simulation is finished
8 s. D- `% f4 X: V% c" b' Ywhile (!Finished) WScript.Sleep(2000);
/ p/ H7 {4 T7 f0 C' W' w9 B 3 Q# B3 J! k+ h& {. c2 ]# m
simple.CloseModel(); # g& f# d- _8 }+ |& O0 A' P) f
simple.Quit();
$ k8 I3 I5 a2 BWScript.Quit(); P& R6 a" Z( u+ O1 ?# ]4 u; q" {
& |+ r: Q* i5 c' N+ y8 |9 J 8 R( M3 Z0 u) x8 w$ T! I2 {
function RemoteControl_SimulationFinished()
# }% C* h5 E& @. M{ & @( m0 c0 ~" N i! O7 h
WScript.Echo("Simulation Finished!"); |