Example of a JScript 0 C0 W& t5 N& F6 O; d' S* G8 w
var vbOKCancel = 1; 4 P/ u$ W8 c: t/ m9 W! K8 l
var vbCancel = 2; 0 a( d# H7 G3 Q1 d9 g
var vbInformation = 64; + V+ X/ e9 c( h0 c& x
var Finished=false; 9 e: t) w# [/ m0 L7 u9 F
/ }$ C% o( R3 S5 p6 A6 ^5 T7 Q1 G6 D
var WSHShell = new ActiveXObject("WScript.Shell"); : d. n5 Z2 m0 h
" d$ f4 J, u* B. n; u3 x& |, }0 U
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 1 b$ X; e2 x8 z$ l' ^
& e: P. _) r: k4 R, y- y4 k7 p
simple.SetLicenseType("Runtime");
. ]. f5 i/ K, S8 [ ^1 n" Z5 S 9 i! l5 P$ D( [; P; J
try / Q2 {) T: A# L6 \3 n
{ % @, R6 X+ R7 W4 Z7 M: n! h
// Enter the path to a model file!
5 [4 k2 F! N2 Y8 t! f- u- U simple.LoadModel("C:\\Models\\Test.spp");
8 [7 r+ a" w+ @6 X}
; i" Y5 X) b7 Pcatch (e)
! d; g3 M( @# C{
. j) ~ w* [# a) x. r- } WScript.Echo("Could not load Model!"); / Z3 U+ y% v! r" j, s& D
WScript.Quit();
3 d4 ~; @( ^7 l* m6 ]% u- r6 V6 r& I} + B- l( C9 j7 P4 f9 _* ~/ h
: p- E, G1 Q- }9 g+ o; W2 x
try 9 r& S5 A- i2 w! ]6 O' W. R) D
{
4 l6 H/ `$ z7 l simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 1 [. I6 s5 p6 ~9 }
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
5 Y# c( T0 |: d1 V7 y2 Z! [ if (r == vbCancel)
: W+ Z& K( t3 I9 P { ; s/ H w+ l& ]1 L0 q( G
simple.CloseModel(); 9 Y5 ]" Q, z0 L9 ^ A
WScript.Quit(); 5 w( R) r1 l) z" o. [
} . Q9 i; ?; ^) W. B9 ?+ |- g5 t& I
} 0 c( ?! \0 b- d
6 l+ |$ l- T; C( ~; z) Rsimple.StartSimulation(".Models.Frame.EventController"); 6 b# c) L3 L, f- \" V
. @2 G) n2 D/ \( Z7 Cif (simple.IsSimulationRunning())
( o- {1 ^; J! E, D {1 H j WScript.Echo("Simulation is running!"); - D9 h! l8 C5 e
, _; a# ~* T2 f9 r1 O// Wait until simulation is finished
3 _* |9 t& E8 Uwhile (!Finished) WScript.Sleep(2000);
2 u4 C4 }+ J, X& F1 A/ i! Z 7 I" h- ?9 F: }! K& V
simple.CloseModel();
! b; o# u" f4 E; L) ]& {simple.Quit(); ( }, t8 d5 [) j' @8 t& G
WScript.Quit(); m% L, |5 G' U2 A$ _! w1 ^" Z
; z1 @9 z F. _' h2 |( J4 e. c! l0 n + h' Q1 w4 w6 u) u3 T- h) {
function RemoteControl_SimulationFinished() 7 |4 n' g' h V7 s
{
y9 B; }/ K6 E WScript.Echo("Simulation Finished!"); |