Example of a JScript
$ F' S% z$ p" m0 T; A1 y( `6 ?/ ^var vbOKCancel = 1;
" v% O! l& V3 p: B" z( s, k. svar vbCancel = 2; & ^/ v- F1 o9 I; n
var vbInformation = 64; 3 y$ j& a u/ L4 F
var Finished=false; * S2 i/ \" a1 L" N3 ^
0 B4 ?4 F4 u6 f5 T- l9 @var WSHShell = new ActiveXObject("WScript.Shell"); 9 L8 s0 n+ c0 N' M$ {/ h" S$ ^
% ?* s& f% a- H' a/ P& t- M) _+ Y
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
0 L b9 \ F" t, d0 Z4 a- u, q ! P5 d/ h- H9 f2 D
simple.SetLicenseType("Runtime");
/ n y' f0 g Y8 n8 |) o
# c6 W: D. x# Z. e( d; g, stry , p, P( R6 m/ m1 P/ `! U
{ ) a# n) M5 |- S3 g- V
// Enter the path to a model file! 4 }" z/ O" z& f+ _0 t; l
simple.LoadModel("C:\\Models\\Test.spp");
0 ^' g% U) G. ?2 O4 G} . }4 Q2 B! J' [% D2 A
catch (e)
7 ]( U7 J p j/ l{
) m4 b! v s" g7 ^3 x+ H WScript.Echo("Could not load Model!"); : `- e, m3 p* Y1 m( G. Y; y
WScript.Quit();
: d) _% L1 N! q. q} : I0 Y, a: T# v6 o9 r2 O& I
7 E8 j6 Q/ n" X" b+ s. j6 w' v7 I. btry $ V/ H; ~( H. f0 H
{ ! _5 J# i6 b! {3 O$ S) U
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
& ~- j6 O4 z8 x) n7 x( x r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 6 w- v: S& d/ e7 i
if (r == vbCancel)
3 h9 P+ v) m0 n; k( o. t { ; L7 g6 ~$ ~3 c8 w* J
simple.CloseModel(); : k% J1 S1 }$ `" ~. @/ K6 e0 R7 K
WScript.Quit();
$ F0 }$ ?, E; U: z }
# m+ ]/ H+ Y2 _$ _3 ^}
% n3 N) j( J# p8 A
8 E* U8 A% \6 o7 S6 T( gsimple.StartSimulation(".Models.Frame.EventController");
9 k$ y& k `" ^2 W1 b5 w
% N. `! u4 k1 a2 _if (simple.IsSimulationRunning())
" V2 `5 d4 y8 S/ s/ X WScript.Echo("Simulation is running!");
" m6 X1 ~4 _' s# K) g$ J W5 g5 S 3 ~% k9 r. c* g! N6 E: Q
// Wait until simulation is finished / u* c) q# p5 I8 M
while (!Finished) WScript.Sleep(2000);
+ a4 g6 _/ I. N0 A# i9 |9 [; u+ a, G 8 B& L5 ?$ P# B$ w5 q I! w! H
simple.CloseModel(); 9 ?! w% r2 b: F3 K1 D
simple.Quit(); : M' k) A3 ~; N& B, i4 r& r' T
WScript.Quit();
. T( }; M7 ], K8 m8 D, | 3 O$ L, C/ H3 l1 w2 w5 L$ C
# F) ~0 S0 @" ?& efunction RemoteControl_SimulationFinished() & o1 B* e9 r @: Z) h
{
1 r5 S7 p9 t/ h2 o) I# ]* q WScript.Echo("Simulation Finished!"); |