Example of a JScript / F$ U/ R6 J% }% T
var vbOKCancel = 1;
, q( Z1 ]) o. R V% }var vbCancel = 2;
# a$ v. {7 a. {! ^var vbInformation = 64; 6 S3 p7 i, ~! T; ^6 z6 j' F% M: L h
var Finished=false;
7 y- H4 `5 g+ w3 ?
7 @9 N% |8 _* l! D( }var WSHShell = new ActiveXObject("WScript.Shell"); ) y% C- ~% U9 G0 m: x
/ c9 H) i9 R/ ~' ]2 P- {# b; G
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
! Z+ P" d$ p: ?
L& A1 ~1 `0 l% hsimple.SetLicenseType("Runtime");
( H4 _/ K% ]/ }) K: j9 ? q/ G; h' A9 f7 C( y; O9 D) W
try ! x8 U1 Q8 C- ^2 t( e
{ : d9 ]- Q$ X3 d7 C o5 W1 \' z- n
// Enter the path to a model file! 5 Y4 V' W; | j2 P2 q
simple.LoadModel("C:\\Models\\Test.spp"); , T, |6 P. m! l4 |" f9 c
}
4 u4 W' F% N* }7 n/ Bcatch (e)
7 ~* a/ j! L0 j3 _& S{
& p& J1 m$ J+ \, U, r2 u WScript.Echo("Could not load Model!"); D" H8 Z! h# b
WScript.Quit();
2 k! H' t' l& \0 B& p/ k! ?, n}
5 D9 \1 ]9 `; ~
* r+ w1 G% x0 \ ?# N# `try
" a+ i4 H3 c. b' I- n3 F+ D{
& T' E" R- e' ~! C simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
/ j8 F8 ?/ ^% F/ a( `# o# V! M/ y2 l r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
% [3 J3 f, i& D1 B( O; O if (r == vbCancel) 1 g: o+ E7 F3 i4 Q
{ / i# g p3 |' }) P* U, R
simple.CloseModel(); + ^4 C# i" _" I' P; J( m {
WScript.Quit(); 4 P2 e6 ]+ ?. B$ Q
}
! ~. u) e ^2 ^& \9 g) b: P( { p& R}
- _* Q: i& n4 t7 _9 N " l3 ~$ R, s4 S4 w
simple.StartSimulation(".Models.Frame.EventController"); $ k% T9 s4 Y! z# v/ C1 V5 Z+ V# c
# m3 e& G6 I' }5 a% Bif (simple.IsSimulationRunning())
! }0 S1 L6 P! l& i7 R$ I7 i WScript.Echo("Simulation is running!");
1 {; M# T' f3 ]; w. _
. u. M1 w$ W8 }* Q8 ^// Wait until simulation is finished
) }* ?- @% \5 ?+ |) s" P) c4 xwhile (!Finished) WScript.Sleep(2000); - K8 X& y( J0 e/ J+ ]
1 N4 ^6 m1 L s& {3 ?
simple.CloseModel(); , t9 A$ d5 H+ k1 j) U2 o
simple.Quit(); 3 }- ], w7 a: } V3 |* P
WScript.Quit();
7 o. u% O7 R% B" k" I1 u4 c 0 Z+ j4 Y2 L d: k/ w, J% |* w
% J2 T+ }$ }. ^! T9 j" kfunction RemoteControl_SimulationFinished()
& c7 U/ N; [8 a; ?& B8 m# F1 |+ x{ ; W, A2 ]4 t) X# d( f' O: F
WScript.Echo("Simulation Finished!"); |