Example of a JScript
) g( J9 A, D2 ] ~& h4 f# uvar vbOKCancel = 1;
& B, k3 ]* y( _2 ^" y. uvar vbCancel = 2;
3 k% m1 m1 Q8 r; P4 C8 tvar vbInformation = 64;
6 x8 |" Q( u# a3 C* pvar Finished=false; . ^! p0 J4 a8 u% D! E
8 f6 y/ H8 l. F: Ivar WSHShell = new ActiveXObject("WScript.Shell"); # o3 k0 x* I; m
5 M8 U2 t2 y4 A
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); / r: {3 O7 s3 S+ G5 A/ Y; i8 {
; i4 X) W% B& Fsimple.SetLicenseType("Runtime");
, V2 A; N; S" j9 C( R9 |
9 R2 N( B) m% f. M# S! P) Y/ f2 Itry
9 c2 H5 {: ?0 ]& P{
3 f% B+ E' o5 Q8 z5 F+ l // Enter the path to a model file!
) i( V) q+ f5 s' ^2 X simple.LoadModel("C:\\Models\\Test.spp"); ) Z+ T8 R! w3 _, S9 w2 v( k* t
} m6 d( C: I) h& t) U
catch (e)
- Q% n- |7 d) j+ a; }! i( C{ * x4 ^2 H/ }2 L8 I2 [& A! `
WScript.Echo("Could not load Model!"); : @1 q) R. \7 w$ e" T% Q5 [
WScript.Quit(); 2 F6 z/ W3 d7 F4 C0 z
} 1 g! C$ u. ^# h( M
8 C9 B# }* P8 E3 \* `
try
& Y2 J5 L n7 [7 h4 {{ $ }2 I+ @# {- Q! D- D' N
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ! D9 U/ a4 S0 j4 |2 }7 I
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 0 n2 G6 a8 p3 C" I0 W7 p* r7 o
if (r == vbCancel)
* f( G. y; r: N% b {
: p" I# z7 [3 B4 R3 ] simple.CloseModel(); 7 r8 ]2 g# x4 Z" Y, x
WScript.Quit(); . W8 V* F6 n ?
} * K ~8 U4 b" B& |
} 5 D2 [4 K( W9 |* K. J
0 ~" L$ z& k6 r2 n1 ?) V, e
simple.StartSimulation(".Models.Frame.EventController"); 7 q* |: _) j; B: A; B
5 G. u& ?: ]- P! `$ I; l& R
if (simple.IsSimulationRunning()) ( Z5 l' X, _7 {: D4 _: o
WScript.Echo("Simulation is running!");
# J5 {" Q2 i1 K z0 {
- j$ F: C( T* `8 Z& I8 K// Wait until simulation is finished
- Q! A% _ n- y. b! ~3 ?4 u: Hwhile (!Finished) WScript.Sleep(2000);
! ^1 D! x! P9 F. n" K7 W
6 f# P7 K$ N" H' z r! @simple.CloseModel(); 9 Y& G2 I4 O7 c% b( w
simple.Quit();
- T% [, M* @6 Z" KWScript.Quit(); 3 [0 o% y% W c5 U, e' e+ R8 a
M4 w" Y. X* x( r% g% f
0 v4 `/ ^5 v: F" @
function RemoteControl_SimulationFinished() 8 L- t. Q$ `! i+ U% M5 x
{ ; [8 X9 S" W. p* |& ]
WScript.Echo("Simulation Finished!"); |