Example of a JScript
. x, [9 C% P9 y2 n, avar vbOKCancel = 1;
. c# y" o# W: G3 ]3 Xvar vbCancel = 2; 7 a! r/ w. r* h- B' r* m% c$ ~
var vbInformation = 64;
3 Z% u9 W, M- z0 b# Y3 Hvar Finished=false; " ^& a% v$ F9 @6 @6 M
) M- _% U& B$ M4 X$ Evar WSHShell = new ActiveXObject("WScript.Shell"); ) g- t: o! g: |1 y% ~ E
( ?& w; x( z& `/ O* t# P9 E
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 0 O8 N' {; F$ M. S
V9 E4 k: M8 n% ?simple.SetLicenseType("Runtime"); . e9 L/ j, H; D
! d* r3 {6 ?! P ~2 Y8 Gtry
O/ C9 M$ G- h4 Q% N{ / t' U5 n2 q6 a {1 z1 y
// Enter the path to a model file!
! _3 P( H9 F: p$ E4 G+ K simple.LoadModel("C:\\Models\\Test.spp");
+ h& M; s- w; z+ m2 y( N S}
$ k }7 D$ m* n3 h8 Zcatch (e)
" E d. O' P+ s' V{ 4 y* U* l0 e$ m% I3 r
WScript.Echo("Could not load Model!");
" V8 y5 A6 X' d0 ^2 a1 j) ]4 @ WScript.Quit(); ! W+ U# M% q' [4 }" c# t5 m( o$ g
} ; Z+ h' Z4 [- @, K: X
: l$ ~" I0 Q5 M4 q% ]7 t0 a) mtry
6 Z8 _/ }$ d0 U d5 J{
9 l! O: o: C' k# i1 [& F% k9 N# p simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
5 }# e$ s) {( n* o! f2 }+ | r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 7 d' m1 l" R7 {- V5 @0 t3 t
if (r == vbCancel)
# F/ Y; [1 F4 s+ E9 O, z o {
& ?! V& l5 Z6 t simple.CloseModel();
7 m' E( ]( x% Q A# @5 G WScript.Quit(); & X B2 Y6 q/ R6 F$ a1 ?
} m x! D+ M' {, _* S4 u
} ' w5 t% T f3 s y% g
8 j( Q) }* H- u4 a, R7 ssimple.StartSimulation(".Models.Frame.EventController");
- @4 J- y! A% F) Q" I- }" t; [
3 o0 ]/ C, N# w3 n# O9 C9 Q2 Fif (simple.IsSimulationRunning())
# O: V0 z1 D2 L1 S9 Q' S: A WScript.Echo("Simulation is running!");
" m5 X9 `0 C$ x . U6 s" q H& M" M! S. g
// Wait until simulation is finished
2 X) z6 F5 g; k* K* vwhile (!Finished) WScript.Sleep(2000);
6 s/ c$ ^( X+ d2 }9 z# y2 Q ) m2 O& `8 X9 [' L
simple.CloseModel(); % E1 ]$ B9 i: R$ p4 z0 {. [
simple.Quit(); . `1 |& ?9 D& I) r0 l
WScript.Quit();
" x5 E' J. E2 \4 W: ^/ F 4 T! }: ?2 ^1 F( f9 o$ l& b; T& x
4 c0 l+ N7 B- \6 b! E* H" x
function RemoteControl_SimulationFinished() 1 o& X3 q! z0 u" Q4 e* C" T8 m
{ $ K$ x/ d1 P) U! O0 W
WScript.Echo("Simulation Finished!"); |