Example of a JScript
$ q! i: c r5 Uvar vbOKCancel = 1; ) v% F% D* }; Y% i+ s( y( a- W
var vbCancel = 2; 0 g9 E+ E& N3 E( j
var vbInformation = 64;
9 k0 C. A( ]% U& j" D8 C1 c7 @var Finished=false; 4 C- j: s9 d) D1 W( l8 Z+ d
$ K2 u7 ?9 y0 S4 a3 E# Q& Z9 Wvar WSHShell = new ActiveXObject("WScript.Shell");
% Q0 U- b- p. q9 m4 _
6 P9 F4 b! d& ^; T9 ]var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); C) ]! q! r; c: ~% g: u# d7 z
* f# k {5 Y! |+ f* X
simple.SetLicenseType("Runtime"); - w1 B. |; B* [9 N
* [! X6 J0 a6 t6 P2 K
try
; |9 K W$ M" n- H4 F{ 5 a5 m* s8 Y6 I( t, }5 A
// Enter the path to a model file! 4 b& s1 ?: l+ r- ^
simple.LoadModel("C:\\Models\\Test.spp");
W+ G8 h' }% h1 G} " l, N4 O$ o7 i1 Y0 _" H h* B: n
catch (e)
, M9 ?( A- v, Q1 G ^3 R" \{
: {0 }) i5 N8 n8 q8 U/ O8 `1 g WScript.Echo("Could not load Model!");
4 C1 H) e; Q% K3 o; b8 \4 i+ { WScript.Quit();
, L: c" P- b. g}
8 D2 J4 Z9 _/ ?/ y1 h4 w% }, Z
; }& j D" `2 [& stry : T) [4 L; w. v. K. @9 H8 }9 {+ l
{
/ @5 `2 X( O0 q5 U/ M* K) B simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
& [! T+ Y! u5 n! D% Z r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
' y; d! H8 ~1 K0 c2 e if (r == vbCancel)
& ]( a9 V8 p) F% J& @ {
! g+ L: [2 l# u! a. t, ` simple.CloseModel();
/ I" ?$ X: z# B. w) ? WScript.Quit(); 4 P. A$ L, G2 N7 Q) B
}
! F5 s# ]4 q& ?$ |" S} % P, t7 i2 ` e) a9 q
) y) X- b2 T, g; |& ysimple.StartSimulation(".Models.Frame.EventController");
1 N0 S; T! r8 A; l ! v# G% k& j2 f
if (simple.IsSimulationRunning())
* i' l5 r" {, m9 v0 k- R# [: W WScript.Echo("Simulation is running!");
3 u# z4 i! R9 z$ G" U
+ w8 m2 ]3 `; P, d" W// Wait until simulation is finished 0 V7 A6 b$ B5 I' @3 g
while (!Finished) WScript.Sleep(2000); $ Y0 c5 }* l* B8 n
: W* e3 n$ S1 L/ R+ csimple.CloseModel(); ' I. {! W+ I* W6 p, ?
simple.Quit();
( \+ @$ l8 ?+ m8 h0 VWScript.Quit();
+ l" p4 p" L( [9 [' R# b
( C% J' c; M5 M$ l
7 u$ z- u$ A6 |# ~function RemoteControl_SimulationFinished()
2 u& w4 B' F7 b" z5 q' b/ z{
% o* f+ p2 J. F$ j# w7 A WScript.Echo("Simulation Finished!"); |