Example of a JScript
; x2 Z: O" A3 z+ F$ V- L, F) cvar vbOKCancel = 1;
% Z3 D0 A0 _" pvar vbCancel = 2; 8 q8 s- ~4 i/ C* V
var vbInformation = 64; 1 ]8 E% C* @5 G9 H( J9 A
var Finished=false;
! x- _( ^; w4 g% t) v' t& ]3 S: G , n5 ~' V4 Q) [( \6 ]% ^- t
var WSHShell = new ActiveXObject("WScript.Shell");
" U9 ~+ `' \% r) d
; ]; M( B% ~. ~# J/ ovar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ! v9 {# s _' ]. l1 v
# {- t; B) N5 \$ R% t8 ~9 E6 Fsimple.SetLicenseType("Runtime");
3 I# M5 F+ K! l6 G% f# [6 y# E4 T6 M 8 b) n* w4 E& [, C1 h2 a( X% o
try * U7 w: y9 M2 v7 t
{
- X1 A: C- X) Z* g+ S // Enter the path to a model file! % j% z4 E" o: r( X6 }3 y. w
simple.LoadModel("C:\\Models\\Test.spp");
9 d: |' d9 E. \9 }* W2 Y4 y* J! g}
$ h7 h2 n; ~) Ycatch (e)
4 h- k7 s" @3 A# T8 w z% B{
2 C& E# Z- ^% W9 } WScript.Echo("Could not load Model!"); - H( W% R; u( h# L& j V, W
WScript.Quit(); 6 t* [. A9 ?5 _, M5 q
}
, t8 C9 q3 I/ {; k, f4 v
( Q7 b7 c; c+ jtry
+ D' S; D2 f0 P( Y" r+ |! B8 a8 t{ & |; M' [* e |: F: B {: F
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ i7 r& B. ^/ I1 l) l8 s5 a r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); $ J2 s. e: A4 A* }, \9 X, o
if (r == vbCancel) " {: G, O* P( |' ~, O; s
{ $ q3 n+ Z) u5 K6 D, j, C
simple.CloseModel(); # C: A8 K4 q/ P4 A! o4 Q5 f* b% o5 h* s
WScript.Quit();
( u" d6 |* i% z0 _9 k) e } ) f: n& P3 \3 W' D# \) x# a
}
7 {. r7 N2 ~2 x" |% w" E( ~
& a, f1 ?( E0 H( _: Vsimple.StartSimulation(".Models.Frame.EventController");
% e/ s3 u- J' y& `2 G5 s 3 F) V2 K! B2 |4 ?/ H- h& d
if (simple.IsSimulationRunning())
/ Q3 x$ M: k6 G$ R8 D WScript.Echo("Simulation is running!");
2 y( {% x; B2 Z8 P, f* _: u% D 2 Z+ B) P/ K3 q9 [8 E4 p9 k
// Wait until simulation is finished
7 I0 Q; n: d7 T& R3 @" `0 I3 g4 A# ewhile (!Finished) WScript.Sleep(2000); : M5 L$ a7 T0 {0 r9 Z
( L5 k5 Y& ^1 B. S! Asimple.CloseModel();
$ B [/ R1 J- a" H5 J9 f+ Psimple.Quit(); # ]/ U; r$ M2 }8 w
WScript.Quit(); 7 b2 d0 q! V! X* B: ~
- L& N) p. l; j; O% J }
7 d+ j. a+ r0 y3 j0 ?function RemoteControl_SimulationFinished()
/ i! }- H7 M3 |. b{ ; q. b) H$ h& h& ?. F' A2 z- D
WScript.Echo("Simulation Finished!"); |