Example of a JScript
% W2 o- V0 A9 C7 C) s+ q* fvar vbOKCancel = 1; * g7 ^: |6 N2 E' K# a1 q7 A0 \: W! O
var vbCancel = 2; ) `$ q1 g- h9 @- n0 _- d
var vbInformation = 64; 7 N( k0 _& e- Z6 n7 H$ Y
var Finished=false; ( h* @ k' b: D" V$ w: z. V% n' V
$ |3 g+ g+ y) V0 k
var WSHShell = new ActiveXObject("WScript.Shell");
1 g% R7 e! D# r( H! _! j) P$ U ! u5 U& g* G* e6 s2 t8 a
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 4 e+ S, g, v" u2 w" h# q
$ b: k0 F3 c' q! K
simple.SetLicenseType("Runtime"); . M/ S4 q$ z) k, C/ u! X
- {- T* d1 t2 j
try
# W. G# I5 @. H4 x" j{ # M% C8 k! M) K, O2 z0 R9 L# w1 o
// Enter the path to a model file! 1 q. ^( m9 m1 X7 m+ Z: L8 h
simple.LoadModel("C:\\Models\\Test.spp"); * M8 d# W8 { l, \. [, C( _) Y
}
. G, l9 K& f& i) Rcatch (e)
1 H- o0 Q. r8 B( m2 Q# T7 h% z{
- @& n: }- c# w/ w WScript.Echo("Could not load Model!"); 9 K; p/ `; B3 I% ?- i' e
WScript.Quit(); & @- u- @2 h v/ {) |8 B; p
} ( F# a6 D# D4 d" T; I/ |5 B9 B& c5 \
9 b1 J+ f, z/ d m8 J4 U
try + s. k$ T' U5 }; `
{
& t: f4 I0 k# h4 }# w, m! B; D simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
) W, b# f# M+ k" \ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); C* f: f# V! q6 ?. L B
if (r == vbCancel) 4 n5 |& u- l1 |; U, O1 y( [
{ 5 ~- d, Y: y- ]! e8 F* ~
simple.CloseModel();
: W! N0 n. L2 @9 u9 d WScript.Quit();
4 Q* y J; v2 L1 N }
, g9 P" ~9 R8 k+ q) @} & b1 H1 D, w) y1 k. [) B& j
4 Z" P. r9 q4 g8 f5 t4 |# Osimple.StartSimulation(".Models.Frame.EventController"); * v& C. U& P: Y7 j$ @4 N: x. a
8 g+ @! a8 S" x a( s e; \/ i4 h
if (simple.IsSimulationRunning())
1 R1 E2 ^* f& Q$ ~ WScript.Echo("Simulation is running!"); % a6 i0 ]% A/ R5 T
; t- w1 R- q3 |/ i- V& e" x// Wait until simulation is finished
( y" f1 v& l/ N, w1 U7 B6 swhile (!Finished) WScript.Sleep(2000);
/ v5 E4 B2 E) @
1 W% u- H; H5 v, P$ {6 u: I! W$ qsimple.CloseModel(); ; o6 M0 O n8 [, O$ T! P
simple.Quit();
2 E& f" ]' @" ^; o* D, rWScript.Quit();
0 i. ~7 w5 D5 [% V 7 t( j" Q3 x5 y3 [' C% I
3 \ ], Y' @; k8 a- T, bfunction RemoteControl_SimulationFinished() 2 O0 \3 ]' G; [7 k* J
{ ! s7 {7 }, h" f: U: A4 `
WScript.Echo("Simulation Finished!"); |