Example of a JScript - |0 H' \* g8 {' X+ p3 j' Y5 h
var vbOKCancel = 1; " A! y" S2 x6 x8 E: s- \
var vbCancel = 2;
" U$ y8 F5 ~, Jvar vbInformation = 64;
0 Y: @& \+ ?3 V) B$ Yvar Finished=false; - p. ^) A- [& I9 c' a4 l
" ?/ l# o! t4 F' T
var WSHShell = new ActiveXObject("WScript.Shell"); ]8 u r$ E# a# ~5 [9 o" \
. a$ z1 Z+ E' o8 {* ?( |2 gvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
4 U3 i' |' x; C
9 D, R1 [ o n3 [$ l) i9 }' Qsimple.SetLicenseType("Runtime");
$ w: e- I. u0 Y' P& d, L $ I0 _5 f; E( C# ?5 b" B
try # d5 v4 n7 l. ?" ?
{ + ?+ E1 l# G* h* J" v2 A$ `
// Enter the path to a model file!
* I$ e7 u9 ?! v' W/ ~: o simple.LoadModel("C:\\Models\\Test.spp");
" d1 G4 e% l+ ~ I8 |; \/ U: W}
& }2 q% t! @& P& |catch (e)
I* i6 w9 a9 C6 `{ 7 v! w- s% z1 H. |" s$ Q; b/ z) M& ~
WScript.Echo("Could not load Model!");
6 d7 b# I% ?8 b& y( z WScript.Quit(); 3 u& O# [6 A; X3 H. A
} + o. \* _' g/ Z4 M1 K& z
0 R/ D9 f/ v1 V& j
try / G1 I# P7 V3 c" X9 q% D
{
r8 E6 R. L( h6 w2 y* ^ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { % X3 o$ C. f Z2 f9 T
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
" y( |& C% u8 P, I3 Q if (r == vbCancel) W# @* f6 I7 w n: \: X
{ 6 }3 Q+ T7 _1 r( q/ z0 b0 O
simple.CloseModel(); 6 T$ H' t& D5 e( q( V7 y7 b
WScript.Quit();
+ N- ?- B) c+ M+ z3 L4 t4 G# } }
0 L# ?8 |; P/ ]. @4 s}
) E7 d5 y$ b( V$ f1 ]& b) }0 c
: G9 `- Y3 O: W, P8 ssimple.StartSimulation(".Models.Frame.EventController");
' A. Y# @5 M4 A* {9 p
! C. \$ Q- M# _# Y4 M0 j0 `, F( Kif (simple.IsSimulationRunning()) 3 V8 L+ x: b) P! v. a @) p' f
WScript.Echo("Simulation is running!"); " q# d5 m$ o0 c, r# V$ }. D5 m9 g
0 B- ]9 p$ M+ J" h
// Wait until simulation is finished , Q5 P. D, z8 T8 i
while (!Finished) WScript.Sleep(2000);
7 S& l: m$ f, d, q7 M; U2 c
, ^: b. [% ?* V: s' K j6 W4 rsimple.CloseModel(); * R) H' {) i) Z" R2 S- Q
simple.Quit(); 0 L4 g: y2 R4 {4 r
WScript.Quit(); ' y! V8 c3 a5 u; H$ ?
% {. P* A; r) o3 Y* c
M4 i1 y. r$ {/ G- h8 Nfunction RemoteControl_SimulationFinished() : r) w. G8 Y( b
{ 7 _. V; L9 f% h. y, P+ H$ n; o! d
WScript.Echo("Simulation Finished!"); |