Example of a JScript
! @8 g4 ?/ w# Vvar vbOKCancel = 1;
/ n# m \3 C( d a- Yvar vbCancel = 2;
5 V5 l ]" s# B0 b0 `3 i2 K4 A: F9 Pvar vbInformation = 64;
, F, }3 A( E8 H0 uvar Finished=false;
2 L9 s8 _7 i7 R3 k
8 A" U3 n# Q( kvar WSHShell = new ActiveXObject("WScript.Shell"); + w T& u3 n1 o3 V0 ]7 K
* j: ]3 S' Z+ p. c8 _
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 5 ~7 Q% F3 a8 r& j: o( ]
/ s. x: A! J, `8 o& a
simple.SetLicenseType("Runtime");
9 U/ g4 m' \- u9 n
H4 P) [6 E$ e2 {try ; P' ^, B. S5 F/ d
{
, N1 n: `, g. ^. d+ V9 P // Enter the path to a model file!
3 X7 ~5 r& L! T- c# z9 ` simple.LoadModel("C:\\Models\\Test.spp"); " Y$ w# `8 N, T" Q6 m- ^) w
} 3 j4 V) Z! a C( w( w8 O1 m( r
catch (e) 4 e& Q& G, ^7 l+ d8 ^
{ : U9 r8 ]( [. |/ i3 L* i
WScript.Echo("Could not load Model!"); 6 p" Y; _0 H) T$ n( R; g3 w
WScript.Quit(); $ B% Z- @: b6 {. W
}
+ G* Z% g; j. M* v' [/ a 2 R }4 F% _' G5 L2 z: b
try 3 I& V! n- x) G) D$ T& f+ s6 y) o4 A
{ * o. s9 W) |. N( J+ R u4 b, B
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { : ?1 h: m2 x5 m- k$ ^- x3 f
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); , n& Z( I7 n6 o8 @
if (r == vbCancel)
' K+ I; v7 w9 g, u {
+ i' ~7 y) B) } P2 b simple.CloseModel(); ! W0 Y2 J! V& n% j- o* V2 c. C$ w+ L
WScript.Quit(); & f/ Q: T8 X5 u7 `& S1 A9 b
}
. k$ j1 J9 g! [$ N}
) { B- F0 f3 N! D- S1 s ' L% X: P: o7 c
simple.StartSimulation(".Models.Frame.EventController");
1 j! Y0 _' P a/ M * o5 g# V5 }, y: b# k* v
if (simple.IsSimulationRunning())
4 ? l' z$ l+ M& y( } WScript.Echo("Simulation is running!"); * X0 |) O2 D0 p
: u# m. Q4 ?4 b6 Y( n$ v
// Wait until simulation is finished 3 b9 |7 ?. N: j# [ G
while (!Finished) WScript.Sleep(2000);
( J ] v9 u d$ t : y9 G/ K, f+ M# ^
simple.CloseModel(); h) n9 h" `3 B7 F! i* v S
simple.Quit(); ) q: i5 w; h* Q2 w: A k
WScript.Quit();
1 E9 A8 V# N& p4 v @) P
7 S& e# ~0 p( s- M F6 F8 w
, W+ S3 O0 `( k, g* L/ |function RemoteControl_SimulationFinished() ) _4 ?4 A1 s$ H9 G$ i( K
{
% N3 d2 Z0 u- [ WScript.Echo("Simulation Finished!"); |