Example of a JScript 7 d# X l: a* k
var vbOKCancel = 1;
- M4 t) v" t, y" ?2 ^4 c7 Xvar vbCancel = 2; + Q- c1 Z d) }/ z
var vbInformation = 64; $ L* n4 a& V4 @3 O* c0 J
var Finished=false;
6 l4 {% I: I# n4 t
7 j; X7 |, l0 B' kvar WSHShell = new ActiveXObject("WScript.Shell"); $ ^ E$ v$ d# V2 |$ a+ b& e4 k. {
w. w% G0 R5 U3 Lvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
9 p+ N, w+ n+ Q1 k ; M! t2 N' u' K1 a5 D9 Q" r! A1 }6 g2 S
simple.SetLicenseType("Runtime");
' v1 g) a; B. z8 g* E1 k9 X , Z& m% K3 N. |) d$ }' b$ p8 I
try
G# d! N, {5 B5 Q3 M{ 3 v6 p3 A6 s9 a0 R) Q) }8 b
// Enter the path to a model file! 0 E+ j( q5 w3 X7 A; Z
simple.LoadModel("C:\\Models\\Test.spp");
( |! K5 F g+ M& r8 r! L' p6 M} 9 }& E r' I8 u
catch (e)
. w" _8 o3 w# I{
2 k0 w5 A3 Z% ~0 M( E# V WScript.Echo("Could not load Model!");
7 C" k& H8 K5 p+ e: ]+ B WScript.Quit(); ( j1 y. _- r) f. ~1 J! A
} / h& I* f5 Z0 v% N
% j9 n7 C; X& ]1 Z: F' n5 U8 Ptry . l2 v9 N$ w8 ?0 P! U9 W9 [
{ : j. }. Y$ y ~ Z& v9 ^4 ]0 j: }
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
8 j4 e* A4 r" G% I5 h! _ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
, D( E$ ?8 A. f6 L! \! i if (r == vbCancel) 9 U2 {- t5 I1 K- X3 n
{
9 X, r' G( i, I% i, y k3 i simple.CloseModel();
8 W. r2 w& f1 d. h- d- n WScript.Quit();
# u3 @& y8 r! L, R* e& r+ B } ' w7 V1 Q3 \+ v7 ]5 H' r. G
} 3 L* i& U- G6 |3 \/ ]0 U' q
% d. u, Z+ v% G- H
simple.StartSimulation(".Models.Frame.EventController");
$ {8 U% j1 Y7 ~! V& ?( @/ R. ~
0 Z4 m" G0 q/ k; Y$ Bif (simple.IsSimulationRunning())
& K6 B, U7 W8 Y- ^ WScript.Echo("Simulation is running!");
# T. H {) [( J: y- p( y/ r+ F
B, b w3 Q5 a: F! l/ o$ u& w// Wait until simulation is finished
9 s3 `" X% T# ~% A& |while (!Finished) WScript.Sleep(2000);
3 Z0 P# U8 u- v4 u. K; k% q" {5 D' ] 5 w6 g1 o9 i) H) C% p! e7 H
simple.CloseModel();
$ D" X9 M8 Y/ v5 v! x& O# @2 u- Msimple.Quit(); 3 J+ k7 k4 K. l! P: E& h3 J# t
WScript.Quit(); 0 K+ [0 y( E9 P! F1 {( m
# f/ }) q7 Y* d8 B
# w5 Y) u! t ffunction RemoteControl_SimulationFinished()
0 m; B% n3 C8 b$ C- a w{ " N: U7 B- L4 {& z1 p6 @* K
WScript.Echo("Simulation Finished!"); |