Example of a JScript
* B/ |. U4 Z- j& n/ @/ P# ?var vbOKCancel = 1;
$ S" K2 J, X! @8 \5 m; k* `9 s/ W& Nvar vbCancel = 2; ( {- o, L5 _7 z2 i6 b
var vbInformation = 64; : @" w+ ^& _% M' Z# w7 t1 o
var Finished=false; 5 J' e: Q0 U( T! G. ^; @
f! h2 L. H: } D' O/ i5 l1 d- [
var WSHShell = new ActiveXObject("WScript.Shell");
4 @7 ?9 }6 C* t/ N( y( c6 n- z + X/ E6 B$ T. K0 C' F
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); " C1 t# p, }$ y: R1 O
2 @' y9 P' Y9 J
simple.SetLicenseType("Runtime"); 7 F+ T$ \5 X: p+ V" L4 F% O
/ `1 w5 P# h" S9 a
try - Q$ X y! w" [" d' K* e
{
- z+ I3 `& R3 F, F0 p. K: a3 B // Enter the path to a model file! ' a* W- Q: Z1 g( L
simple.LoadModel("C:\\Models\\Test.spp"); ' W3 l* Z6 I! _' O8 }
}
7 d! N5 S$ ~2 p. N+ G5 p* {, ~catch (e)
+ r# f9 L! d# Z{ 7 L& C9 U3 K+ U. ~( g
WScript.Echo("Could not load Model!");
* \/ F" F7 q+ \+ y WScript.Quit();
3 l5 ?) ]. g% @}
/ ?; x) K9 ?1 i0 e% q- F
, |$ q1 B1 Q& P$ T! _try
2 j6 j7 y. `# f) S0 i{
, v1 a. v/ E: i# `+ u: {0 I simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 7 [0 T4 j- q( a2 L4 a( L" E( g+ U: [3 z
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
/ u, K# A; L5 Q+ l3 X if (r == vbCancel)
6 t6 n( M$ Y' H) q1 m L {
) G: k- k4 u5 u' \: V2 S# d. ? simple.CloseModel();
: T, \0 Q4 L3 r% r5 z8 I WScript.Quit();
! z8 a5 f7 E! a0 j" f5 ` } ) B- J9 s$ g! K0 z; I+ `
}
7 O, h/ L) L6 Q, u6 B2 M" g3 g
' V7 X5 I8 S: asimple.StartSimulation(".Models.Frame.EventController"); . ?8 `2 j' ?) h- `+ S
, h; L0 w$ c1 U3 x+ p0 bif (simple.IsSimulationRunning()) % x9 ^0 x# |4 ?
WScript.Echo("Simulation is running!"); % d% E: P9 S1 L! |2 X% z7 P
V, A8 M: y% m! ]' P! c
// Wait until simulation is finished
/ T F0 Z& J2 W7 Twhile (!Finished) WScript.Sleep(2000); 5 z* l8 B+ Y3 c
' i, W; t2 A: _ ^; P6 @simple.CloseModel();
: z( I: ]' t1 J A9 i1 U' Psimple.Quit(); 2 K9 Z7 O0 T5 p, o9 C1 I
WScript.Quit(); 8 a" C6 L- f$ n! x% l6 c9 q R
2 \/ Y* j. S$ ~: d# H
7 i( F7 u/ K2 u3 V4 u( @; G5 Cfunction RemoteControl_SimulationFinished()
% F9 }- W# I' _* M# [9 Z{ # T k& a5 i8 R4 S
WScript.Echo("Simulation Finished!"); |