Example of a JScript
" n' T3 G6 B, T: L$ A+ }6 A8 h( Dvar vbOKCancel = 1;
& [% I2 N8 l/ dvar vbCancel = 2;
' y! D- i K+ l5 A8 hvar vbInformation = 64; ! l2 @# }$ p! y4 J/ c
var Finished=false; ( v ?6 A% {+ l+ y A
2 ?! O C4 u- tvar WSHShell = new ActiveXObject("WScript.Shell");
% q4 Z' l6 Y: H* I: A 2 a% {. B6 Q$ q/ p
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
( i( B& ?) M2 y) y
$ ^' u( d W. jsimple.SetLicenseType("Runtime");
- {+ Q) \) X- ?6 B; w0 C S% y
. w* o M6 M* W6 Q& \try
4 g5 G6 I; j+ k% C5 C{
# P; _2 }4 V# @8 q8 A // Enter the path to a model file!
# q3 w0 s/ } M; e simple.LoadModel("C:\\Models\\Test.spp");
; u1 P T8 B- M$ o) R: Z [$ A6 [} : J4 E3 w& J, o
catch (e)
' {; S! c% ~% L2 x+ n1 a{ + W0 e5 L2 M* {1 E
WScript.Echo("Could not load Model!"); # j* u% P f0 {( H# Z* Y
WScript.Quit();
( Y7 C2 C5 r" o5 }- b$ N$ B& K}
1 a$ @, D' n& _1 U# r4 S
. p* q- z7 }4 J) b2 s3 Gtry 3 A8 [9 q/ {2 g
{ 5 D* `4 y2 |0 |$ ^+ V N" J
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
/ U; J5 S& [: T- |' v8 O r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
* l% W4 n1 j" D4 [# G if (r == vbCancel) 6 K9 ^# r1 d. Y; A" x
{ 2 f2 _: ]1 {$ N' p s
simple.CloseModel(); 6 x2 K' ?6 n! `- K$ }
WScript.Quit();
: j; t4 T+ S/ P3 R } - s% |. y1 F( A# M5 Q6 \& \
}
6 C; D, l" u( s6 N. g - X! L/ I Q. P% G* H( e
simple.StartSimulation(".Models.Frame.EventController");
4 ~$ @% U0 l8 K 2 R$ D4 J1 a; k: J% x7 ]
if (simple.IsSimulationRunning())
: U; O9 Q8 A+ x! w WScript.Echo("Simulation is running!");
: u' n+ G4 j8 u4 R 8 Q4 r( \$ o/ i
// Wait until simulation is finished
, c; \- i M3 [3 l: O/ H# M" L. ~/ |while (!Finished) WScript.Sleep(2000); 9 c s. G+ E- V
/ `, ~. T+ N# Q$ ]6 Zsimple.CloseModel();
* n, N) X4 P7 n N- o4 Ksimple.Quit();
4 Q& R+ U* ^" Q8 v/ WWScript.Quit();
! h: Q! z* W) G: v
& n* T p. j' P0 w7 v
/ f3 c7 {2 ~; K; [8 r. K- _function RemoteControl_SimulationFinished()
$ O! D Y: {% n- C{ y, z7 o) x- e' @
WScript.Echo("Simulation Finished!"); |