Example of a JScript 6 L- I! Q% j: n' e+ o' e0 ~
var vbOKCancel = 1; : ^9 \+ g6 k1 J6 F( {* J. m4 j
var vbCancel = 2; # d( Q' y) f4 f$ E9 {6 T$ y3 ^
var vbInformation = 64;
. V( e# k o3 Y8 l: B/ j$ rvar Finished=false; + v% F! D; m0 @) U! q
+ ~- f) C3 U$ t1 g# e7 z, Avar WSHShell = new ActiveXObject("WScript.Shell");
9 w! T: ^3 r8 U* v' {) H
& V" N( C( ~ ?! X6 ivar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); . e6 f3 \, M& H* L$ D
- ~: n( r% A0 U% g; z, ~simple.SetLicenseType("Runtime");
& n3 V8 F) B1 c7 X
9 i: y6 I) h4 R1 d0 |9 }try ) C6 ?8 ~4 |6 w$ d/ [" V
{ 6 }. {# d% H3 m
// Enter the path to a model file! : E" B, x3 f0 s8 N1 p: \5 [& c
simple.LoadModel("C:\\Models\\Test.spp"); * c# D8 K7 \) X, x; h! P% |+ E
}
" ? M4 r+ _8 W& u) ycatch (e) 1 I" r3 Y6 s1 e
{
* |, m* s# r/ r4 A. ` WScript.Echo("Could not load Model!");
0 {% R2 K) R! Z" g. ` WScript.Quit();
: a: H) I' }9 t! u K# C}
, J6 }9 R4 a& S) o7 @6 R5 D ' D" I* F; M1 u7 S# J* e* J3 O
try
1 d$ w0 m# ~- C' c; k! t4 f; `{
( C. F' V, }# \- M simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
6 J; @. t3 |) U; L1 j+ z! _' E' Z r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); $ f) n6 l1 }8 o$ f$ k1 n
if (r == vbCancel) 8 T& }) X4 N9 e
{
8 _8 _7 Z9 T% k7 W" D7 ~( M simple.CloseModel(); ' j+ v. q1 o. p8 }1 G
WScript.Quit(); 0 }# N0 v: |$ x6 c# m
}
9 K! o/ ]5 |2 V8 W! ?( j} 7 z- t, [! x" {
, o, s) Z* }4 W! O( n gsimple.StartSimulation(".Models.Frame.EventController");
% Y* ?" q9 e" f1 j6 _
3 ]9 ~: K$ D) Hif (simple.IsSimulationRunning())
% b. n6 c! L: k, _! A( R WScript.Echo("Simulation is running!"); 0 f! l, A4 o: ?( K% R4 _
5 D1 }' {. B# B" i4 c, O// Wait until simulation is finished 0 D- k1 [' A8 l0 J3 E* f* z
while (!Finished) WScript.Sleep(2000);
3 y# {# p* }$ b9 V/ S & @+ O: b- g# L8 l1 U& F
simple.CloseModel(); ! g5 l# R5 \; L0 c
simple.Quit(); * O5 I- P" ~( g
WScript.Quit();
; C$ _7 m- {2 O7 n
; l A" P( L6 { 6 g) r/ x9 A1 A
function RemoteControl_SimulationFinished() ' G6 i1 M1 H+ S
{
2 q4 K \, b0 f# n9 K WScript.Echo("Simulation Finished!"); |