Example of a JScript
- B8 C" _* H5 c' Yvar vbOKCancel = 1;
" }* {0 F4 q# e* L) L: cvar vbCancel = 2; 6 v: d, L6 M4 G
var vbInformation = 64; ' m. Z- S0 Q& I3 \% H4 E
var Finished=false;
& q P0 ]1 k0 M7 f
8 I+ k- Z8 d3 a4 v9 K1 j1 O! Yvar WSHShell = new ActiveXObject("WScript.Shell");
. s" T1 f' Y; E* f$ ~+ ~ k
. [+ I1 n! N5 j5 n3 Tvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); : F# U6 K' X8 Y( h
9 u" f- z6 |, Y4 B/ D
simple.SetLicenseType("Runtime"); + R# O" @( c3 Q/ m
( d" j( n/ J; ~/ \" ?/ _9 o
try
( P c2 X, k3 W d! `& j{ , `5 s; [' D8 P6 z7 z( I" B
// Enter the path to a model file! 0 m% r: O- h2 Z4 r' W
simple.LoadModel("C:\\Models\\Test.spp"); . s! [3 l# H4 w! S3 x$ c
}
& ~+ [- W; F9 q2 tcatch (e)
! C3 Q# q1 L1 D0 R1 g9 Q{ & x6 ?+ Z; f# L% M5 ^
WScript.Echo("Could not load Model!"); $ D. t" F; C# }
WScript.Quit();
) X% [& ?- x+ X2 }}
/ A* o& f. S- D
5 L3 d% q f8 @try + z: v& b" c9 G- d
{ 8 d! L+ c) P! y2 u& S/ ]3 ^
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
i, i Z5 t8 x/ r, v+ k1 r r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); + c! }; E, v/ Y' n
if (r == vbCancel)
0 g% l+ r" s: C" Y+ a* i1 Y5 H# F { ' m. [7 Q7 X: L: }* M
simple.CloseModel();
. m c: O: u. |6 K WScript.Quit(); & d* ^+ ]/ T6 h0 P' n w. {* B
}
9 [5 i: n3 r1 L2 W: o% f} 4 U5 I2 \7 v- l
3 h8 Y; ^2 s# k1 D2 _+ k0 y
simple.StartSimulation(".Models.Frame.EventController");
1 S# q( o$ }1 |0 Q2 P7 k% I
2 u# O. p- N6 k. pif (simple.IsSimulationRunning()) 1 M& s; M) I& L$ A& Y
WScript.Echo("Simulation is running!"); , R( T9 n! w5 g
& E" {$ i" ~1 m( ~
// Wait until simulation is finished * F: T; T ]+ u
while (!Finished) WScript.Sleep(2000);
4 q& Q, A+ P: c% M; ~. w; r( x
; A8 v, A" h6 p' \9 Asimple.CloseModel(); |$ Y& B& k+ s0 k4 ?; L
simple.Quit(); ( U8 M# q6 i! S6 V8 H
WScript.Quit(); ) |$ G% E: r0 b: v
$ e9 t) u7 w- t3 _8 c
! T, b$ c0 a6 {
function RemoteControl_SimulationFinished()
$ k$ @4 B" n9 p{
* W! ? T2 C0 _3 A7 { WScript.Echo("Simulation Finished!"); |