Example of a JScript
8 K4 f# \3 \% s; E2 x6 J) U, [var vbOKCancel = 1;
$ V3 v$ Q$ _3 e9 zvar vbCancel = 2;
! ?6 V* A8 a& u w3 V; R1 ovar vbInformation = 64; 1 X" Y, t4 u) ]9 V" {
var Finished=false;
8 G. f8 `+ P# v
9 I g% A8 k1 T2 E' p z+ vvar WSHShell = new ActiveXObject("WScript.Shell"); + O. g- b7 l _0 k' i, A' F0 S! S1 g
7 l( ~+ }& j n; j' @
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
" d; a7 Q- r. e( k$ \
4 ~/ N1 X" M5 M [2 b- bsimple.SetLicenseType("Runtime"); 9 D* j0 s3 F2 X) r
- z& d2 { E% }8 ttry
/ q+ ~: B' w* ]3 B{ / w: u; {5 Q. Y6 D6 O% C$ ~
// Enter the path to a model file!
4 ?1 q) C2 e% A' o8 j simple.LoadModel("C:\\Models\\Test.spp"); ( S/ B+ V; d* Z* {
} 1 }$ |4 C* x; r" a* i# u
catch (e)
2 { V, j# f$ ]4 c/ j1 T{
. V. ^$ X/ Y5 g1 i& |, L WScript.Echo("Could not load Model!"); $ p: \! C/ `: l' \4 Z/ y9 |( ~( X& C
WScript.Quit();
+ ]8 l, v, u0 Z# n} ' q* q% r4 `# E9 _$ o2 b. I. ]+ R, X
& b0 {0 d1 k' F4 [
try
6 k: ^6 L- ]6 X- u3 Y{
( E/ }$ x$ X" I4 E5 h simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
% T/ }. o1 M! R$ _: L8 Z' s r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
) W6 Q n/ h6 s* k) G! T) G) h if (r == vbCancel)
% A; ]" O+ J2 ], _* K9 f) v7 F {
/ U! N6 p) C0 j5 R. q$ n simple.CloseModel();
& n: l0 g( I# Z7 X4 [# z+ Z! P WScript.Quit(); " D1 f2 b; {4 z* G
}
$ R# W% N1 A8 B) T4 L- u. D& }}
& ]: Q! j1 p1 t, e7 { n% ~- ^
0 o# m( K; I! @3 J8 `% ^9 ^# dsimple.StartSimulation(".Models.Frame.EventController"); + s x: C7 b+ B; C/ J4 e* m
2 A0 O* t2 e* L; K5 h
if (simple.IsSimulationRunning())
+ Y$ r) e9 Z4 }" n WScript.Echo("Simulation is running!");
, ^/ ]3 z8 d; b' y
: A" f% o& u( D2 V, \& k// Wait until simulation is finished 1 q# q6 E. z. N
while (!Finished) WScript.Sleep(2000);
, e1 y- B/ s c, ~2 t- E 7 _: M4 @1 F R2 k: ~
simple.CloseModel();
3 V+ S) F Q( O( }$ Z& }( Tsimple.Quit();
! p$ ]) ]/ i, O9 G; j4 GWScript.Quit(); - J; g2 ~3 u% {/ B5 H: H
" ?) E: R/ p1 ~/ o
: t! [. |* q- c9 j# Q4 F) Gfunction RemoteControl_SimulationFinished() 2 F. B- k9 r- p. M1 L9 e
{ , N' l6 @" l' K w
WScript.Echo("Simulation Finished!"); |