Example of a JScript
7 ~+ e- I7 ]9 ~5 ~* ~& Hvar vbOKCancel = 1; $ U: `4 C. ~/ y! b1 B
var vbCancel = 2; 2 B% K( V; q8 p5 ~. d3 \
var vbInformation = 64; ! }' r0 A5 n1 {( d& e
var Finished=false;
- G! {" X% L( P6 V. x( g 6 u- F" i$ ~% ~' t3 A
var WSHShell = new ActiveXObject("WScript.Shell");
8 z8 O7 `( [6 ]+ {
& K& M; d% p& \; lvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) P5 R( G0 b/ E! C/ M& w5 {
# B) w+ a# H* ~$ s; h# v& ysimple.SetLicenseType("Runtime"); 8 g i; B6 M( L
! a% Y& Y" K- I( l! A9 D
try
' G/ w6 \; \7 B! G( g, ^' o{ 1 K0 K$ c9 ~& A" M
// Enter the path to a model file! " G/ t: @; c2 e& N* c! X
simple.LoadModel("C:\\Models\\Test.spp");
! @7 t5 u3 i1 }2 k; G% T# l( B} % G6 g: w9 J* A5 I) e* j& \
catch (e)
6 ~; z9 X/ _& _& v* y{ " ?! @& _% D4 q4 r+ U; c
WScript.Echo("Could not load Model!");
1 J; R W4 j! F5 H/ S5 x8 u WScript.Quit(); 8 C& f: F0 G: ~0 Z5 Y8 C
} % P: G! Q( l) N0 _3 t+ t: G
( [$ E+ F) l9 ^$ q. stry " \ C* V7 I7 k+ q+ l- i! } k) V
{ / g% u" n' i! x4 }6 F D
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { & Z* k3 g, e& S/ e$ M S
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 6 L& w( P n# I: J2 U- d0 S$ M/ G
if (r == vbCancel)
4 d0 i: O2 f4 \8 n { ( G2 C6 F9 n4 B) q1 R: \
simple.CloseModel(); 0 }* U) j- u( ~8 p5 |
WScript.Quit(); 8 Y; ?+ ^+ q& `
} . M z `1 w) I* _: A: B7 G# L
} ' S: y! p T7 m% h, k
3 d# i. B& w5 A& ~simple.StartSimulation(".Models.Frame.EventController"); 5 i o# c+ S0 G9 |$ N
I. t1 A5 L, V# L, Q! b
if (simple.IsSimulationRunning()) % q" o4 G- {% d, `" }/ N3 v
WScript.Echo("Simulation is running!");
2 u* `1 f E# t! W3 C8 C+ t
5 y6 X& [. B; ?1 f) p// Wait until simulation is finished
/ u2 A7 ?9 p1 Q' Jwhile (!Finished) WScript.Sleep(2000);
: ^- j& o+ S2 q3 n ' j) @5 e3 E5 V9 k7 L7 _
simple.CloseModel();
~& o4 G3 R; G4 Lsimple.Quit();
: Q' A9 n0 I& b$ R8 }, J Z" S8 _ G/ lWScript.Quit();
0 ]- y0 Q; [- o. {& ~+ C- ] - a' A, J% [7 `. c4 A
X: z$ a; } ?$ |
function RemoteControl_SimulationFinished()
- h1 \7 ~" O2 M2 l- r- n{ 1 K: D/ }% A+ d+ C$ u- H6 F
WScript.Echo("Simulation Finished!"); |