Example of a JScript 8 ^1 C$ g: M; \
var vbOKCancel = 1; + ]4 Z$ P; V4 r- `8 ~& m
var vbCancel = 2; 6 Y6 I$ p b6 w+ B5 Z* E4 Z) A
var vbInformation = 64;
" u9 m& Q! |; A5 X8 ~8 E# q, i9 Evar Finished=false;
% z/ ^7 ^8 B) G: O' s1 t0 h - m9 ]: z/ ^; z6 n, h
var WSHShell = new ActiveXObject("WScript.Shell");
2 r; I6 Z% |9 e 7 z0 g, I5 |$ R" Q4 O
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
+ ^9 C9 a7 @& f3 _6 C 7 a- n+ D* z2 h$ p4 }# d( O
simple.SetLicenseType("Runtime"); 9 S- G4 z5 E* w) o
# \# ]/ ^2 | A T/ r0 Q5 H8 h1 \/ L
try 6 y/ `- B0 p! y& u. x/ a9 z6 T
{
0 [6 k' k% Y& O6 L // Enter the path to a model file! " f7 U* m3 o4 f5 F; o+ L: }+ V
simple.LoadModel("C:\\Models\\Test.spp"); " X) D9 h$ F0 S7 K
}
" A. M* X- N: P ?2 Y6 Kcatch (e) ! \, G1 @% |) R
{ 9 H, K; L, O- Y; q" x
WScript.Echo("Could not load Model!"); 5 r! _/ c, s3 I( y( D ?# K
WScript.Quit(); 0 T0 x! c) z! |; @
} - U) p. L. ^( z7 u; a1 k
/ i7 v0 P: {& \. a" ~1 g" htry : O7 y" @+ x# D: f: N5 q, a; x E
{ % D. b6 K# d5 Y; W# _( T5 n
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { + T) l4 o$ F( x9 f! L
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
- t- {; v- ~& k" S if (r == vbCancel)
$ v2 V( d4 k) \! g7 u2 Y* x { 1 _+ A3 F5 f- z' @
simple.CloseModel();
* W5 }: V! T& x% I* c WScript.Quit();
# P- ~ T, P" {. Z. r8 t6 Y }
' @/ J" R# a8 S: E9 n6 Z5 m}
4 D5 v7 X4 c( O: A9 m1 I9 g . _! P5 u I$ F3 X
simple.StartSimulation(".Models.Frame.EventController");
' \* b" P3 N4 H7 g4 |7 G, y/ Z
9 S3 x5 X: H% @5 e% E1 gif (simple.IsSimulationRunning()) ! A+ ] j* a4 M. k) w! }
WScript.Echo("Simulation is running!");
( Z& l0 m7 w3 c$ h$ Y& Y& Z $ X* \; n+ S( W' p8 h
// Wait until simulation is finished
/ W# Y! u& t( s* O3 U" r) q* vwhile (!Finished) WScript.Sleep(2000);
$ ~# b; g# g% ?5 r6 P( e
9 a4 a; u+ [1 ]+ T% |: K7 }simple.CloseModel();
! D3 F* Q2 x: asimple.Quit();
' i/ Z& T1 ^6 |$ x* @WScript.Quit(); $ p# ]# K, I/ a( @$ W9 e( Y
" e) V/ i& O& m$ {2 z* D1 q1 u
$ }4 H0 Z: E' ]5 pfunction RemoteControl_SimulationFinished() + j" b% D: w, M( ^7 U, {3 d
{
( O# V( i g0 @; _7 H7 z WScript.Echo("Simulation Finished!"); |