Example of a JScript
) _5 S5 q4 v: |" Mvar vbOKCancel = 1; ( F$ g5 l' C S
var vbCancel = 2; - m( d* M2 ?+ x$ X6 G+ [1 j
var vbInformation = 64; 8 }; x" }2 [' c8 w3 m0 _
var Finished=false;
; ~, @1 j+ k5 s9 Y* c) N8 z $ P: D8 P& Q/ ?' W6 Z
var WSHShell = new ActiveXObject("WScript.Shell"); $ V+ |3 t8 }& y
& G! D7 g, x5 y# ?: x
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
1 c% `( T% Z; \- D. F+ f 0 l) U# z# u0 {! {: Q
simple.SetLicenseType("Runtime"); X) Z2 f. ^- Z7 B
! U6 F( u; n# `+ Htry & u) y4 i/ f$ T
{ 7 Y: \% W5 J- D) B N. V
// Enter the path to a model file!
/ x5 z/ E( k: O$ N U" _: ^7 a simple.LoadModel("C:\\Models\\Test.spp");
0 o- e' ^7 c# ~} " N5 o- D3 b# b% g3 G3 c, L7 w
catch (e)
" i V2 ]( C& f7 N; ?{ : _: R& f7 s% x( T
WScript.Echo("Could not load Model!");
1 ~! A* `& P# v* m* w+ c$ t$ w9 u( a: t WScript.Quit();
4 X4 @- u3 z) W* ~; a5 E} 2 O( Z9 X Q; A" C3 R$ r1 N& B& V
) }( N( D5 Y8 P+ H+ r$ i
try % l1 K. {' k) _2 _4 I+ o6 y
{ 1 Q8 l2 @( ~5 I6 j4 e
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ' y) ]4 C. V( R) t1 n1 n( a
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); . H2 f" T0 U U) {( V8 V- e
if (r == vbCancel) 1 m: u# F; Q; p! r5 v8 ~# Z
{
' u7 V; p8 E: w' X# Y2 t simple.CloseModel(); + i9 N d9 G5 M. i' e1 A
WScript.Quit(); 4 H, u5 V- m. T( z4 a
} # {( j2 \3 j# q
}
* m5 y, \+ `, _/ i, K5 u# g
! ?8 H& q! ^0 u2 I2 J. E ?simple.StartSimulation(".Models.Frame.EventController");
8 L/ R+ z) v7 Z' k- I& s + D6 H ?) U/ N7 R8 @# I
if (simple.IsSimulationRunning())
8 z, g% I" I$ m, ]& T3 Z6 P4 ?0 U WScript.Echo("Simulation is running!"); & E6 M; t5 d4 S5 y2 E
+ z3 t) T7 l: t7 {
// Wait until simulation is finished
, U) |; j; `- J% x8 _while (!Finished) WScript.Sleep(2000); 1 |% ]' a$ S7 L7 u0 C
) s% Q8 U0 y O
simple.CloseModel();
4 ]3 F! w' E2 n+ D& `, g% fsimple.Quit(); , P. c6 x( @; u, u+ H4 b3 y: g
WScript.Quit();
: T+ F$ b1 M, ? a$ h9 e4 a
) Y A T; ], ^
J' g W! F% @, i8 I) tfunction RemoteControl_SimulationFinished()
3 I, H1 F3 u+ z{
5 Z& `) d& e5 g# w( _ WScript.Echo("Simulation Finished!"); |