Example of a JScript
% t! f9 U% l0 g& {: J8 Kvar vbOKCancel = 1;
7 O3 j" s: B6 J' }& @: A) `: k- Xvar vbCancel = 2; 1 G& U1 _& [$ s9 M& n! U X9 I) @3 r
var vbInformation = 64; # b% w! l8 b9 u3 @, {
var Finished=false;
2 B& ?; n" l/ M d) X
7 s/ N+ ^# c- j' W* ~& ~ l4 nvar WSHShell = new ActiveXObject("WScript.Shell"); . Y) W' x6 Y* O7 l
" g0 a. M# S. o" ?9 h7 i
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * B: U6 f& ], K5 D( U! p
6 I" I+ F3 x2 c3 D4 w! E% Esimple.SetLicenseType("Runtime");
4 j2 H& U- j# x. B/ K ! O/ g+ F8 g6 i& L+ y/ C( d* o
try
; h: C! B8 N) J6 l6 j+ Y4 A) c{ & t0 L+ V* c, L2 D Z2 X9 e: H
// Enter the path to a model file!
/ }! g" |$ G; w: a" `7 ^ simple.LoadModel("C:\\Models\\Test.spp");
* `; q, I3 u! Z! p5 H. S}
5 _, H( I3 P/ ]2 G- `catch (e)
. \% O7 l& o) t: e! } \) i4 m{ ( ~* a' @( }* H$ t( P& \3 j
WScript.Echo("Could not load Model!");
+ u' H8 k) p$ e j4 u WScript.Quit(); & \+ f8 }7 f& t3 e; _
} / _! z9 h2 f6 B: K
4 c. {$ g# V; e' n1 B Ltry
$ d% H% l* x, L% w+ B& E{ 0 ?. L" n1 e; z6 ~* i
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { " ]' g t' o# B5 G
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 9 q9 p$ ^& E3 F7 r
if (r == vbCancel)
' |0 ~7 Q1 Q" M) z# s. ]& D {
: n4 h- x) @; w f& m% ^! f3 K simple.CloseModel(); % c+ J3 N6 j# s" R+ V2 }1 p
WScript.Quit(); q2 l# N5 [7 u
} 7 _1 y% I+ k# g! }3 [
} 5 L" R5 f& H; H4 N% j
5 Y0 f0 Y! Y4 Y4 \* F/ K
simple.StartSimulation(".Models.Frame.EventController"); ' j" K7 P( l& q4 `" R* x
, H! r! d G# }) p6 Iif (simple.IsSimulationRunning()) " {# |# m& q. M: w R
WScript.Echo("Simulation is running!");
0 o C& v* n: k$ w" q
( B, H/ z$ e, P; j// Wait until simulation is finished
2 W3 w. A: E+ w, [while (!Finished) WScript.Sleep(2000);
2 A( B5 e B% x6 H
1 N: t3 D' p2 o8 H- j# L2 g2 X0 Hsimple.CloseModel(); ; l0 i. f; d; P% r8 Y
simple.Quit();
. _/ A/ u: h6 o2 F. R4 G0 DWScript.Quit();
2 B9 g. W' C0 C
0 b3 r' ?/ D/ U r1 I- c
) z7 ]* M& [. w* U& B G% s, Wfunction RemoteControl_SimulationFinished()
/ l% @( h* p3 [: }% q+ O7 s2 I{
& F" D B/ T H9 h2 j I WScript.Echo("Simulation Finished!"); |