Example of a JScript
* `1 }) X/ }# L- |var vbOKCancel = 1;
g) l1 W# v$ }# L! @' @$ }var vbCancel = 2; G0 ~: e- E& }: D) P% K
var vbInformation = 64; 2 H2 b# [6 x7 F
var Finished=false;
7 h0 Z% e! x- Y3 M , B8 @4 z: \: P6 f' N
var WSHShell = new ActiveXObject("WScript.Shell");
8 E( A) h$ `7 V7 G
% Y4 O( P2 q* E4 a( T1 gvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
+ \; g _% N9 \! O* @6 A4 _ ( N9 l9 E1 }2 i' a2 X
simple.SetLicenseType("Runtime");
( [2 |5 I4 K+ t' P* w
( R$ i' D) ]: r) d z6 Z; W8 {try
. ^/ l+ k4 j) C" D0 K6 H% W6 _{ 9 c' z5 }2 m0 c
// Enter the path to a model file! 5 G* s( O2 o5 t& a
simple.LoadModel("C:\\Models\\Test.spp");
* ~ q4 q. A$ P' a( Z" B' G}
2 S/ f/ w5 ^& L1 ncatch (e)
( L8 d2 Y2 O" R. D7 Z/ D$ x{ 7 v7 E Z+ \$ h _1 Z% F
WScript.Echo("Could not load Model!"); : c8 |2 Y; g& u( \( V: p7 `4 a
WScript.Quit(); % K3 g3 ^3 L( \
}
( H+ S$ S7 y( @/ o9 B
- i2 \8 r- I! Htry
; J7 W, I+ W) k{ : t2 J+ j: A, p
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
$ ]5 A7 |' J! r% u6 y r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & Z* E; x- _$ W$ \
if (r == vbCancel)
1 _- \. O4 X8 v8 t { $ ~( a. z3 d, D! q: W
simple.CloseModel();
1 t; u" ~; h& Y6 n' J2 K2 H1 j WScript.Quit();
0 r3 d( e0 d: }: Y9 v/ K } , [5 ^7 l! Y6 l
}
5 W+ N" ]# j6 V! Q# ?% x' d - a0 Q. p& C% f8 \: f
simple.StartSimulation(".Models.Frame.EventController");
+ g4 S' b, z& E" s8 ]/ p8 ] 0 A7 W" ]3 G' c. Y
if (simple.IsSimulationRunning()) 1 C- P4 q5 X# r
WScript.Echo("Simulation is running!");
# F/ p. J# K2 P; x6 y & l) h* s) ^& y# Y
// Wait until simulation is finished ; |" N3 d M2 r D; [
while (!Finished) WScript.Sleep(2000); ' L }" C* w7 _5 O; J- V
; G2 `# @: ^4 W6 ?7 fsimple.CloseModel();
z8 U! d# `* Asimple.Quit();
1 c& ~) y) q+ N+ \9 O8 F3 kWScript.Quit();
a3 i* X; ]- H/ E1 S
* { m7 S ] A 1 w# N. C7 j5 u% h3 X4 o6 D; ~9 l
function RemoteControl_SimulationFinished() - m4 ^1 C/ y- [( {3 V D
{
8 _ Z7 j6 _ w s$ } WScript.Echo("Simulation Finished!"); |