Example of a JScript
9 z7 D2 X) X* Y- K7 h# tvar vbOKCancel = 1;
& ^, q. I0 S7 s* N& c; cvar vbCancel = 2; # Y" J. B" f/ J i- G
var vbInformation = 64;
$ j8 V _ M: c0 |# [& Rvar Finished=false; 4 @" L$ l- r# O" |
! ?+ o. b- F3 f- ]
var WSHShell = new ActiveXObject("WScript.Shell");
3 O/ t) {$ @0 R! m0 t : \: H1 W/ A3 S5 z& t4 d% [0 F% S
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); A& |) e2 t: a9 P
8 `5 \, C( C1 S5 b! g' A- K
simple.SetLicenseType("Runtime");
* e: W' r* C' d& y7 O* ?/ k " X8 S: b# Z; |# E) n6 m
try # \! x) g8 R. o' M$ {8 E
{ . F' ?. d8 P/ U% ], {$ y3 j
// Enter the path to a model file! * d; x P1 A- b4 ]8 A) q w- H: N
simple.LoadModel("C:\\Models\\Test.spp"); % B. ]! o! T: E5 s q4 L/ B
}
. v8 u4 q3 C( x4 rcatch (e)
. z! p6 k* ~. d{ 2 ?7 F2 O3 I3 p! Y
WScript.Echo("Could not load Model!");
( `0 a6 W5 W8 ~, N! D4 ?; T WScript.Quit(); , |5 D7 c: p, w
}
) Z' N. g1 L- s: o; B$ v 0 \/ x& L: l8 h
try
# A. _( @: T ?" K{ 4 p" {1 A# @; k& ?. A, M$ Y
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
! _. q, O+ t& K! T! Q9 Z9 v+ R9 | r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
( f& R- N( m C- x2 R7 Z* { W if (r == vbCancel) - {1 ?5 @; }" A6 i9 D
{
6 e/ i. t( d- W/ S. {6 G simple.CloseModel(); P( R1 L* H- G. ^' s; C9 v' u
WScript.Quit();
( k, O7 n! B' S7 C } * y8 j% ]2 }: i/ t- w+ o
}
! S Y, V2 f6 u ' x8 _2 p! } M# ]- G m3 w+ V& W, q
simple.StartSimulation(".Models.Frame.EventController");
; `8 ~1 u2 j- p2 E Q
7 \( D3 I) e% Z5 q% Q7 }9 X3 Kif (simple.IsSimulationRunning()) , r3 W% q$ Y5 L4 o/ R
WScript.Echo("Simulation is running!");
/ z+ v+ I5 C1 L$ T0 {# S
# D# @, F' k3 Y+ R4 k' `// Wait until simulation is finished - K- i5 B4 o2 o: N9 _& k9 t$ Y
while (!Finished) WScript.Sleep(2000);
% P& G, R* V/ y. c5 Z; t4 o 8 T: \. o4 V2 @6 l2 u6 H3 [
simple.CloseModel();
8 q. c- c f, Z. ^6 m3 jsimple.Quit();
3 e' n! G! P5 v7 Q+ qWScript.Quit(); , z0 [4 @8 ~5 {5 E, q
+ A7 [; I ?5 c" z
, H$ S P3 _; i- |+ ^' J4 o
function RemoteControl_SimulationFinished() / }5 H$ ?9 z# `
{ $ f2 B) G& h) d
WScript.Echo("Simulation Finished!"); |