Example of a JScript
2 t2 w1 i8 @7 G0 Bvar vbOKCancel = 1; $ @, _5 ^7 [- P& B: o
var vbCancel = 2;
a- k2 j1 f: M$ H% h0 F( uvar vbInformation = 64; 1 J, r* e0 S0 x; X/ B1 A+ t
var Finished=false; ( S* [+ |/ N* D9 C! C# D
. R' _! V; V, j I
var WSHShell = new ActiveXObject("WScript.Shell");
5 g8 i$ [$ X6 x7 l7 L( p ) L, a1 r$ ?: s) R3 i
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); $ z5 W2 F: G G2 J: w
, g8 J+ N0 K, }& R
simple.SetLicenseType("Runtime");
$ O! ]$ M1 ~* c% j; r/ U' @, B
$ y+ ~: i+ R! x9 a7 [% Ytry 6 {3 y) q! o/ k% ~4 Z
{
- c$ L/ ?4 T+ l' g$ H // Enter the path to a model file! 3 k Q, n% p9 o8 _3 r! o* d+ P
simple.LoadModel("C:\\Models\\Test.spp"); ' A- E n, d! J9 J) M& Y) Y; U( x
} 6 ?2 I& X! }: r6 ]3 Q7 P r
catch (e) / r4 E" m( n8 B: A
{
; F) b0 h7 r0 R6 y7 ? WScript.Echo("Could not load Model!");
5 O0 E% w( ~0 u WScript.Quit(); . U" W H! }- s6 F9 [
} , W6 S! e& X* \) e: u
( w$ P4 f5 L$ w* J3 p* v+ Dtry
4 [8 q; ~" Q& L8 a) V{
3 [9 K$ w, D& X simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { + {4 \. H0 b8 [0 P, f L1 M- \
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); / i* j7 A, @* q
if (r == vbCancel)
. {2 U/ f3 k l& D, ^ { . w5 Z9 f" C- O/ e
simple.CloseModel(); 2 s' }& ?- S' d8 ~+ [
WScript.Quit(); ! E( @- v- m8 M( ~2 p- u5 n2 w
}
I2 M' E* I! C' ~" r" T4 Y}
1 |6 D) k/ V: O7 b* T4 o' d! `8 U2 X9 Y # k2 V" O& S E" C7 h. w3 Y
simple.StartSimulation(".Models.Frame.EventController"); # A8 n* Q# Y" o2 A8 m
9 \' Q$ {- J; Q+ c: N x" r5 C1 q0 Wif (simple.IsSimulationRunning()) ( _" C6 x, Z% u/ N7 \9 f
WScript.Echo("Simulation is running!"); / g" C8 r' E5 L- a$ O
+ |1 ] h, Y* B0 k/ J
// Wait until simulation is finished % m+ c* s' x: V) g7 A' |
while (!Finished) WScript.Sleep(2000); , {4 u4 \; d/ t" r8 E7 y
$ U7 ^( G' Y8 Y k9 y- E" I3 d/ z
simple.CloseModel();
( I! G9 r0 F' C0 F# w" X2 Hsimple.Quit(); % _ @% d8 D$ C8 w* k ~6 X
WScript.Quit(); 5 {. k4 q+ U2 e: g* P
2 D; u4 h3 t& ]" N& m 4 ^0 `& |/ R, }. f; `1 L
function RemoteControl_SimulationFinished() ; |7 y7 C: ^; ~& ?
{ , ~' y" I, V2 M |0 N
WScript.Echo("Simulation Finished!"); |