Example of a JScript / u0 @* a' n6 ^
var vbOKCancel = 1; 8 G3 f3 R- c& |: L- V- a2 X
var vbCancel = 2; 3 X; G! I$ Q5 c+ V- B
var vbInformation = 64;
7 g, r5 _3 D& zvar Finished=false; * R& Y) o4 r6 s* j
' D0 t7 B) V" g# wvar WSHShell = new ActiveXObject("WScript.Shell");
8 n A5 d ~6 p " U8 ^0 v' N0 M" n5 ]& M) g
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * _8 E3 _+ q! ^+ C3 R! [
, f( ]/ r7 ~% z' _simple.SetLicenseType("Runtime");
% L# n+ r( j4 ?, {/ P; [ ; S/ R, D4 ]1 P. C( {, S
try ) b2 g& B2 |0 d
{ / g8 V6 k3 O: v3 `% v$ b# p. v( b2 a
// Enter the path to a model file! # p" F7 n- K" N/ O
simple.LoadModel("C:\\Models\\Test.spp");
( H& U2 ~5 i( J( G; J}
& g5 e: J" h& d: Z; Y- mcatch (e) ' S% r; @6 W( p" Z' g0 \% G2 y
{
2 `9 Y$ ]0 m0 A8 f1 b WScript.Echo("Could not load Model!"); $ E. b0 [7 b1 G8 V$ S
WScript.Quit(); ' O( r6 P8 i+ C( d: m; i5 H
}
) `" ?7 ~! X6 c$ _: n 0 x1 F- \7 o4 q4 l
try
; j) v5 D: P, A$ ?! e8 `7 f2 h, B- _{ ; s& V2 \3 k- W1 h
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
2 S9 A% P# }5 Q2 s r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
* P6 ^$ Y1 ?- k. n/ l4 Y; A if (r == vbCancel) / x! c( w: V [; G/ J P* |/ X
{ % [0 a7 z% _! B2 f- j' J* J
simple.CloseModel(); ) n- q! z" ?$ F% x% W0 o
WScript.Quit();
/ K/ \5 T/ s* a }
- p# x* Z$ o& |: o0 T# `. |} # J0 e# Y6 h. u: A
' U; y; q6 d( c' u. b3 h' _, ssimple.StartSimulation(".Models.Frame.EventController");
- A! F5 b, k! K/ y0 N v- i1 n+ X# D% {
( t6 G+ @1 u: N! B3 {6 g' [1 F lif (simple.IsSimulationRunning()) % _4 r( k% O1 d1 i
WScript.Echo("Simulation is running!"); , ~. p+ W; D$ P1 O; Z, ~
& d0 x; z, j, o
// Wait until simulation is finished
: D2 A3 ]# l4 V2 B8 r' L& m% Bwhile (!Finished) WScript.Sleep(2000);
; ~8 p: J5 r; f $ p6 U' U( J& V# x
simple.CloseModel();
5 u+ w! D3 C5 csimple.Quit();
2 h5 @. I3 w$ C* E8 `; oWScript.Quit(); ! C' m$ S1 ?0 A7 l
+ N& \: Z& z+ ^* h! G8 m8 c- c
$ |- }' }% k/ Y6 {9 Ifunction RemoteControl_SimulationFinished() 8 L: q/ J9 \3 j) ]0 ~
{
0 V M3 D0 h" W2 a; g0 H WScript.Echo("Simulation Finished!"); |