Example of a JScript 5 T- N# T! E6 N1 L
var vbOKCancel = 1;
/ F6 x# d6 R+ T& ~$ T: @) g& c: zvar vbCancel = 2; % A8 ~& a0 j& R" c9 M' f+ R3 p
var vbInformation = 64;
5 d/ H& h; n4 _5 [" l5 H& vvar Finished=false; ' p9 ~8 m {8 i$ f' t! X
, p& k5 ?- Y8 avar WSHShell = new ActiveXObject("WScript.Shell"); 2 v- y2 d' A3 y y! W8 G
6 Z7 G+ n+ a: n6 X: r
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
: b0 ?" P" t) L" b+ C8 k 1 U! u) C/ S, _% }
simple.SetLicenseType("Runtime"); ( B$ I/ o2 B" y- ^5 ~. R0 n
3 ]+ l, M: \* [$ A, X: \, Q) @
try 9 O4 `6 h w! X) j1 q- Y
{ ; b3 ?0 }& S% L4 |4 L3 N( [% H/ n+ c
// Enter the path to a model file!
' f E S1 e1 h2 R3 K simple.LoadModel("C:\\Models\\Test.spp"); ; e+ ?" H* i# x9 o/ v
}
, C9 y) l% z Q0 ccatch (e)
& } R( ?3 D% I! l# @{
9 h7 l! ]4 f0 a# m) ]4 y WScript.Echo("Could not load Model!");
* u; Y+ e( ?' E6 [* ~4 [3 h) i* Z WScript.Quit();
2 b5 `& ^ W O8 i- S: R& n} # o- V x0 I$ D) Q2 W
6 h/ M9 q6 B' E% m* y8 e
try , Y8 u& P8 ^: n; T$ Y
{
/ Z3 T% G; L( A1 O6 l8 f simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 6 R* {0 {$ }) m; I+ P/ j
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); + ? ~9 P% c! {4 s7 V& m
if (r == vbCancel)
: @' r/ |& ]$ \! s { 7 o8 q0 Q2 a; C; E
simple.CloseModel(); ' \' S8 m# o0 |: [% [6 |( w6 t S
WScript.Quit(); ) q5 ~8 _* V" G" y7 C$ y6 v; E
} 9 Q% N3 T' {* Y+ s. h/ b: h
}
! J" I* c+ w3 ], h7 ^, t) z! x
; D; h" w9 {: p- [" Xsimple.StartSimulation(".Models.Frame.EventController"); # u# U, t: B, [: P- g& Z" S$ v
. m6 t9 Z7 w H7 C6 R. V& Uif (simple.IsSimulationRunning()) 9 h' ^6 z) M+ R
WScript.Echo("Simulation is running!");
2 ^% s" T# f) c* p! q
2 z; P' o: X: B+ f y# C* Z// Wait until simulation is finished
, H6 w4 m, J. }1 Nwhile (!Finished) WScript.Sleep(2000); " L5 E0 K6 i8 H5 |
Z. k: a1 J( A( S
simple.CloseModel(); # f% i$ Y/ O" ~) @4 x! u
simple.Quit(); ) \1 {9 c$ n& N9 [
WScript.Quit(); # \1 L% q2 J$ |7 g
) f W7 n2 O9 S" ~2 J, N
9 H9 A+ }% |: \. a& [
function RemoteControl_SimulationFinished()
5 f/ o5 ]" l2 ^{ 4 ^8 v- y! N# ~/ V$ H
WScript.Echo("Simulation Finished!"); |