Example of a JScript # E# ]: X1 ~7 R3 A9 {
var vbOKCancel = 1;
! f' z, \0 ~' a3 nvar vbCancel = 2; 8 X) @7 s. ]- H }
var vbInformation = 64; - F0 ]" q$ Q" v1 J1 N: a0 [
var Finished=false;
P& B$ C$ P* Y ; \8 K7 X# p& Z" b2 K3 B
var WSHShell = new ActiveXObject("WScript.Shell");
- z8 Q. R1 ~% d" N) w+ X$ W2 D! k - x7 g/ ?" x" Y; Y
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); " L$ C! N; i7 l- b3 \# Y: L
( V( x3 Z+ K) J( [1 y5 I; Y
simple.SetLicenseType("Runtime");
% E3 p/ e; I( I$ G
3 d4 V, O6 s+ Y# |8 D! qtry ; J1 }& L# E# z) E7 O: V1 C# V
{ : B0 Y! v/ n( t' ?
// Enter the path to a model file!
% `: I3 o% b. H; t simple.LoadModel("C:\\Models\\Test.spp"); n+ A8 |* @: s6 ~* A
}
$ y7 _, M$ ?( D0 j: K2 B0 @% H$ `catch (e) : P3 l9 l3 Z3 n4 Y3 `
{ % H6 Q3 K) r- S/ s' \0 _ L! p
WScript.Echo("Could not load Model!"); - t, [! @: |1 S& S' P
WScript.Quit();
- c) v0 g& w/ R5 h3 [6 }}
, t" E! l8 Z8 k7 `$ ]9 x' o" o " e5 f0 R, d9 }" I! Q. H
try ( C6 u2 d. {" l, |6 I
{ & @ Z5 U+ q( C4 P# k
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
6 d% l% ]: L/ y& z7 n# H r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
0 H& q1 g t% s# y2 W" Z5 y2 G4 ` if (r == vbCancel)
- d# [* g( Y5 Z { m0 }3 t" v7 k
simple.CloseModel();
' I; h( M: f# j& V3 j9 T WScript.Quit(); 1 y% w" {" r" z0 x) q
} & `7 Z% U j5 K0 y; \4 C
}
9 N) ]( G. G! x/ B- Y
, e* j3 ^; t2 b& d- Z" [+ @. ~. Hsimple.StartSimulation(".Models.Frame.EventController"); a* B; J7 a; e
. e4 ]$ h5 y8 m3 n) G3 |4 Rif (simple.IsSimulationRunning()) 4 N/ o: g$ r1 E* i2 l
WScript.Echo("Simulation is running!");
% ~8 V; {/ u# V6 {+ ~ ; U* ~0 ?# p6 E$ }
// Wait until simulation is finished 7 o5 p0 l0 q d5 c9 c2 J0 t) E
while (!Finished) WScript.Sleep(2000); # C) x4 ^5 a% j( B% l, N7 C+ Z# I
1 c! M2 O" k) c2 P6 ksimple.CloseModel(); 4 s( t, a% i# J6 u! K3 Y; G
simple.Quit();
) `9 f8 q+ B: W9 ~# Z9 b6 W/ EWScript.Quit();
, V2 y: a8 w: s9 J& W : l. i- |: n) ]
3 E& U/ }! V7 F- O$ y
function RemoteControl_SimulationFinished() & g; ^! P2 B6 B) f8 R6 q9 W3 a
{ : Z2 C5 n# S9 i! u; K; L
WScript.Echo("Simulation Finished!"); |