Example of a JScript
+ q, l( ~& C% T) V/ Y1 y( W% jvar vbOKCancel = 1; 5 o: }/ U# v1 r8 a5 o7 C
var vbCancel = 2;
* q4 h R3 r- A, w1 qvar vbInformation = 64; 1 T8 L M: C) F
var Finished=false;
* h# f+ x* @! @3 \8 N 0 a+ g. C# [: B" R6 p
var WSHShell = new ActiveXObject("WScript.Shell"); # _. }: V! ]3 g2 d/ ]) [
9 @# W) e2 b7 s) i0 c8 M
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
* [" W$ D/ j- F6 {3 T
+ ~) [. i" d( `3 `' Hsimple.SetLicenseType("Runtime"); $ I8 [ l$ \ C
/ K' ?, I, l) W. ~; T3 F# k
try 2 q/ e+ w( p2 P& v- l$ N u
{ + b& n- w( e4 a8 U( t6 E
// Enter the path to a model file!
# h) C2 n1 O2 @ simple.LoadModel("C:\\Models\\Test.spp");
* _% D# m# f4 ]/ A+ J; S: X! p2 h}
# t% K5 O# d+ p' e! z: I" Wcatch (e) 4 u( C# T7 e7 W. j' J
{
! `- s+ W$ U |% p7 B WScript.Echo("Could not load Model!"); - z- {5 I0 j. u* a, S
WScript.Quit(); 7 g; Y' Y4 H, j$ y1 o
}
6 e- q# X( ^& P6 N+ K9 s
6 h7 Y0 ]# V' \' C: k$ L$ i; |6 ytry
& ?8 B+ B c( V{ . L/ i* b, M) ?* V
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 6 q$ m0 _& D e9 d) ] F
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
* m$ H. M5 B- R# h$ a9 P/ ~ if (r == vbCancel)
$ j. G9 M& u! j {
) E, q- _, {9 R1 [: h1 N+ ^7 ^1 S simple.CloseModel(); ) z( {6 m( L# G/ j' y) }# i
WScript.Quit();
' d b; E) T/ p } ) y* x( N% V1 d& r y1 T+ ]1 g
} : |( ^4 s6 z: O1 ~
3 H% F7 ~ I% H5 Y2 G5 o5 ] e
simple.StartSimulation(".Models.Frame.EventController");
& U# W" j) e$ \% `
) w, ]( b( E6 u @, b2 e9 kif (simple.IsSimulationRunning()) " S) }$ k0 X8 r
WScript.Echo("Simulation is running!");
* C$ e1 {5 _% r9 |, e
" h* n* g3 [0 n% z; y5 z* g: ^+ m// Wait until simulation is finished
( F1 i+ T8 F. x- bwhile (!Finished) WScript.Sleep(2000); 4 m0 P* J3 I: A5 F* j
/ s: r+ f3 g. ~/ J: U
simple.CloseModel(); / Y2 \2 B1 o: Q, ~8 G" {% ~
simple.Quit();
D# Q$ S$ d* D0 l# X4 }& ^2 xWScript.Quit();
! B0 _+ x" t8 `) c
# F" `" o. W2 S0 I* M; n6 R2 | ) w$ n- V' g B2 z5 g
function RemoteControl_SimulationFinished() ) A& D# u$ H' a
{
8 G2 n4 N- K6 M4 I3 L9 |+ Y) t' M WScript.Echo("Simulation Finished!"); |