Example of a JScript % h, u0 Y; G4 Q1 G& m* V% R9 @
var vbOKCancel = 1;
$ K+ W% T1 G- z+ r* f/ u% }! @var vbCancel = 2;
( t0 Q C Q5 d l0 Svar vbInformation = 64;
9 k: _3 C$ v' [4 t; bvar Finished=false;
9 o; y4 O! {. X: \8 C2 s
& a8 u/ G" ~8 k8 g- u) h1 pvar WSHShell = new ActiveXObject("WScript.Shell");
( B3 F7 X! x: R , P8 X3 B* s M" Q$ I- ^- R: D! w/ P
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
% Q. N% l) S6 d- [4 X7 @7 n0 M
& f; h/ I1 i, a2 e; W/ Msimple.SetLicenseType("Runtime"); 1 K- Y8 v0 P6 P E& p' m/ n- V5 H, F
7 t3 t6 D5 A; P, ^- g
try ! G) D3 T: l, z( k, b% }; H
{ - w u2 B) p% P8 A
// Enter the path to a model file! 3 k6 O4 t. Y1 F2 A5 d
simple.LoadModel("C:\\Models\\Test.spp");
% t- n) W7 Z6 Z- u( w% v}
# V4 j* ^3 z9 ?5 D) R* Ucatch (e) - l+ _5 K7 u7 q y, L$ p
{ " `; [$ X/ g7 x4 c- {
WScript.Echo("Could not load Model!"); 5 }+ q& m1 O$ ^1 R) _
WScript.Quit();
( H* g b# |: i; @7 x} 4 `9 Y4 D% y) ^) ~2 l% i
% N( y, U/ O. x- `$ T, A
try
3 Y* l2 O* A9 v% V; p( B6 p0 c' Y2 N{ # _% r8 O) f# S# V, [: s
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
; N8 r: U1 @7 p4 Y r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
: Z6 R$ W& P. x6 s1 E& {! w1 Y if (r == vbCancel)
H: p) E; g y% T2 c @ {
* {# B |+ L. b5 t; A, m simple.CloseModel(); 6 o0 U' ^1 M6 A8 o* i9 o
WScript.Quit();
D7 Q* X1 J, [/ c7 J! F2 d* G! E$ W } - Q( i4 b& d% R H6 {
} / [# J4 U( g. u% r- }# R$ p
- q, d2 N1 o ~& [. y! \simple.StartSimulation(".Models.Frame.EventController"); & D. [7 C1 P; f( w
: T3 a; N1 a7 a0 L& M
if (simple.IsSimulationRunning()) 0 d9 }) [0 z/ |# Y9 P5 I$ y2 r, Q0 |
WScript.Echo("Simulation is running!"); " u& R6 c- I# K5 V5 d+ R
. r' k3 I! C& {6 J
// Wait until simulation is finished * u+ z( j6 w, A H8 T
while (!Finished) WScript.Sleep(2000);
: A$ |. W$ v; f7 i. ^; b1 w
: w! p% |4 Y4 o1 Lsimple.CloseModel();
v8 B; b* w1 O: Msimple.Quit(); # h6 w! A6 N( T* Z! F' w
WScript.Quit(); ' Z; _, |* c1 [, l
$ G' ^0 `" E/ _
8 d( @3 w7 t0 x+ Q$ [
function RemoteControl_SimulationFinished() * M$ L/ I7 n& B! Q* a
{
8 ]& |/ n% Z- z% }9 w& F WScript.Echo("Simulation Finished!"); |