Example of a JScript 7 q$ e% p& Y1 _3 ?/ \8 z
var vbOKCancel = 1; e& M$ n; z# v
var vbCancel = 2; 3 v9 C5 s3 m- i" c6 G& Z u( x
var vbInformation = 64;
8 _ _. W% I6 w' g3 |: A1 Nvar Finished=false; & G$ G( U- c: R% Y. c7 S
7 h7 S* S/ |8 S8 \/ fvar WSHShell = new ActiveXObject("WScript.Shell"); ' @6 Y; n3 a1 i) G3 U4 j9 u' @2 U
, [5 e8 R4 U& N. d: g0 p+ t4 e# _var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
# J$ ~0 ]' A/ c* s- x; c& M# p+ h% i ( t8 h2 u! H7 a2 U- f0 b( ^4 c
simple.SetLicenseType("Runtime"); $ f8 t7 r. n0 X& l1 |0 J5 ?$ w
% h& v$ B& p" a& H% M3 B2 F9 U
try
( k, Z" K* ?, T/ z$ o$ g) R{
h( N* A, o! U4 A // Enter the path to a model file! % h) [, ?6 W# }0 K
simple.LoadModel("C:\\Models\\Test.spp");
2 n- W7 `1 w" G6 s0 ^$ x} 6 W' p$ {2 u9 D( |8 B! H
catch (e) . r6 M2 V% o! `8 U5 c
{
: n1 X; T! w7 m WScript.Echo("Could not load Model!");
" g5 y+ [4 E% l) T5 g9 d+ v; T WScript.Quit(); 5 z7 Z* Q) [# y1 ` R$ y# h
}
' i: a" n: l) X- c6 g0 e : i4 v. X4 v) [1 w
try
+ h1 `( z. ]2 F8 Q6 ]! M{
2 a5 A) [! j/ _ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { # o6 U% V) f& U9 z. W
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 6 t/ ?( d8 P4 @6 V3 q
if (r == vbCancel)
! u# Y# l# v% C2 d' _: } { , h; I* V# u7 G* s6 S
simple.CloseModel(); 8 s; @. O7 r% K& l% H
WScript.Quit(); : J9 {- A; k3 f( f* l0 e$ d% J
}
8 l) F/ j' U- L* k}
8 A& x6 K+ \: |5 @: z9 ^
3 S8 ^" ]2 _/ asimple.StartSimulation(".Models.Frame.EventController"); 0 I' I/ v" F% `
* a- j. q$ i1 P3 ]9 W1 }1 M
if (simple.IsSimulationRunning())
. f0 y+ [ E& R8 |9 u WScript.Echo("Simulation is running!"); 7 `% K, Q: r! d
L/ ], V( a( f" p7 }. A9 E// Wait until simulation is finished * |1 L7 T* c; o! Y* Z9 d7 g2 p
while (!Finished) WScript.Sleep(2000); , F1 o5 [$ L7 k! W
3 h# y( }* o+ T. _9 D+ s
simple.CloseModel();
5 T% {& M& z5 y+ dsimple.Quit();
$ F4 B5 K S3 ]; u& CWScript.Quit(); ; v% F3 N0 i5 b
! n) j0 ]9 P& \2 Y: u
) [ P" [7 w/ ~: Ofunction RemoteControl_SimulationFinished()
* @1 \/ F2 Z" o& j. ]- g- J( v. g{ ; x- w0 X8 Z7 A, r
WScript.Echo("Simulation Finished!"); |