Example of a JScript
- s: h c, @8 n. I, W- {. xvar vbOKCancel = 1;
4 {" j) D8 |8 ^% j; c* u& Evar vbCancel = 2; 8 Y' f. k( F2 ^9 P$ b0 g1 K4 _
var vbInformation = 64; 4 L* z. V5 A8 a) y
var Finished=false;
9 I" o3 @5 t7 g" H
: o2 y' I$ l, @9 a1 a3 G, Hvar WSHShell = new ActiveXObject("WScript.Shell");
. U. s) K* z: ~7 a
) P. e7 L* ?: h9 y5 ]var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
/ t( x) }+ B; N- Y `
, ^9 D6 C' j9 ]0 lsimple.SetLicenseType("Runtime"); 6 M; B) P% W: D# c/ O
, U6 k: ~+ O% {0 Q& S% o
try
! P2 m& C+ p% r5 b{ 6 G6 M% H% F, b. g3 _/ h
// Enter the path to a model file! # E) w1 _- T3 ^4 v. l. j9 h
simple.LoadModel("C:\\Models\\Test.spp");
) j2 H! w: L- |" A2 ^} 2 l4 _4 Q P, q) M7 r: r
catch (e) 5 n0 O+ v, d# h! N! W4 s
{ 3 o0 U: ^4 p. S4 ]# N# _
WScript.Echo("Could not load Model!"); - M( g0 V$ w l" M' O8 U
WScript.Quit(); 6 c+ G- `/ ^) _- K) I- N, ~
}
8 o& t; N% f1 j# m) r
_9 {6 p4 y" b( ktry
9 R' q; J# h& P+ S, p1 Z{ ) k% m; R% K0 x& R, C+ z
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { / r' B# H- f; r1 ] I* \# E
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); - ?5 c6 e$ |( |: s0 Z' @5 e
if (r == vbCancel) ( Q* s" F7 r; i- }* A& M
{ % N( R3 q5 C8 E; @7 n
simple.CloseModel(); + R/ b3 }) F8 g: U+ C' |% ^
WScript.Quit();
2 {0 p% l' h L }
1 R! }: c8 `8 ?% h: [" A) g}
: g8 K6 G1 V: O5 c E
9 y7 M9 \& ~# M$ Fsimple.StartSimulation(".Models.Frame.EventController");
' u. j8 V; i" i/ k- j! t2 l ; d' l6 Q1 I- Y: C6 L
if (simple.IsSimulationRunning()) - I# I( f7 A5 I: G! M, n
WScript.Echo("Simulation is running!"); l0 F+ d" n7 j0 p4 x" r- n( M6 e* a: C$ C
2 k9 H! Y r/ n, E* g// Wait until simulation is finished
: Y! _% F; ~* t* Xwhile (!Finished) WScript.Sleep(2000); & ~$ c1 |6 R; F+ N) t3 _
6 n& p6 h. L" s$ ysimple.CloseModel(); 2 K. v3 A F5 W9 g9 H2 j
simple.Quit();
8 O# \7 d' b2 g" V* ~6 R) BWScript.Quit(); M/ J4 G1 r/ i" z H
9 N& w* O2 i2 I+ n D K7 h
- R3 i$ T& c: Xfunction RemoteControl_SimulationFinished()
8 u( n s0 C: y/ }/ E2 o{ % c% m. t- z1 m6 Y
WScript.Echo("Simulation Finished!"); |