Example of a JScript
# @' ?9 I1 E. b: u; ~var vbOKCancel = 1;
! V; Y8 b3 L- F; `var vbCancel = 2; ' E8 C0 p' C: F8 T8 _6 b, L5 l7 w
var vbInformation = 64;
3 [% l& R. S* w }; h. j7 ` ^var Finished=false; & v2 f7 l7 j+ w1 G0 w1 I
& N, e: W, S7 G3 L$ f* M
var WSHShell = new ActiveXObject("WScript.Shell");
( D. ^8 j3 q x) a; D
7 M' j h' n t# I/ E7 H$ L; T8 X& I; cvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ( d1 m+ Q% S6 o+ d# u; t
* f" h; _9 a0 t2 \" zsimple.SetLicenseType("Runtime"); 2 {* h) {& h: r3 |
+ \ F: m$ b& i# e3 ]+ x; Y+ y/ otry 7 T& v' u* r9 W$ m+ t
{ 2 K, N- e+ r$ m( R
// Enter the path to a model file!
6 x% [2 m$ w) w- L" m simple.LoadModel("C:\\Models\\Test.spp"); 8 a5 n1 [+ L! P. I' b8 }) J
}
3 L" c4 x/ U: t: D' Wcatch (e)
3 B. k* ]! x, I- o% p8 s9 o{ 2 Q( S$ f' g8 n
WScript.Echo("Could not load Model!");
1 Z2 l) @8 e. R6 o u9 t WScript.Quit();
. \2 L4 f5 z9 Q}
* `4 s0 y: f% _# l , Z: w: I& j. F* I( a
try + I( z5 ?; q& K6 ~/ V
{ ( b* h+ ^' u* p: }7 {% L0 ^2 L. n
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 4 D' n } ~9 v6 B, P+ K
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
" ^1 v, P; S4 \0 N/ ?" w* H if (r == vbCancel) ! ]5 e8 v+ h# m4 E9 S" e& K
{ $ w# p( Z# h/ S# D6 ]
simple.CloseModel();
4 ~( V% A( M3 w( Q( ~, k' ? WScript.Quit();
2 H( E5 `" n9 M+ U( r7 e4 H" b$ h } , Q1 ^8 x4 T I
}
/ p. L) Z; E J& y3 }/ g 7 a6 X" O$ y7 y+ b
simple.StartSimulation(".Models.Frame.EventController"); - Z$ ~5 K0 P" ^& ?# D4 M: q4 R7 p& W
2 S! {7 L7 j v+ Q/ v
if (simple.IsSimulationRunning())
' }) v+ ~& ?) N9 O7 c WScript.Echo("Simulation is running!"); ( Z8 n' n8 A/ n! N/ t. P+ p
/ N( U; Q- v b _6 o/ ~, S& E1 R2 x
// Wait until simulation is finished . L! l; N2 l" B% U! o
while (!Finished) WScript.Sleep(2000);
' b% ]4 p" R# T
+ G3 f- ?/ o8 D6 ?simple.CloseModel(); ! b! E1 L. ]9 w" [- ^, \% i3 t
simple.Quit();
% E8 K: _: w" u$ VWScript.Quit(); * N5 G9 ?# L$ j* F
6 Y" N7 y# m* D1 V
3 V7 b }" \( W9 s2 [, m5 {9 v tfunction RemoteControl_SimulationFinished() & }6 T& Z/ T u* D2 k, C
{
t9 i. O; n5 `" |* P: ?# M WScript.Echo("Simulation Finished!"); |