Example of a JScript
7 E+ a; G- ?* |' i5 {1 F2 ^var vbOKCancel = 1; * W6 b0 Z+ _4 g! a( _
var vbCancel = 2;
6 i/ H; d9 M+ bvar vbInformation = 64; ' L* }+ Y- Z" b, ^& Y. c( p
var Finished=false;
. p, }' i) e" X 8 c3 P4 S0 u1 f" ?" X
var WSHShell = new ActiveXObject("WScript.Shell");
3 L! w3 Q, E* [ $ l, S- D: S2 o
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 1 `) \( \8 E6 l" G1 r
$ R9 {; {2 }1 ~0 e3 Zsimple.SetLicenseType("Runtime"); # C* M) q$ z7 t# t/ A; n
9 P3 L7 V. Y! h/ z& x2 |: v' u) R. n
try
! B0 J; l3 E: ^{
# R5 L( t9 c) U; H _ // Enter the path to a model file! & n1 Q$ A- m& E" ~; W( u* ^* K: u9 i. P
simple.LoadModel("C:\\Models\\Test.spp"); ! F7 s, ?3 @ Z
} ' b7 b" J \# J; }
catch (e) ! I; @/ }" s7 N
{
5 B$ L |, G" J/ V! i- Q) e WScript.Echo("Could not load Model!"); " }6 P8 Q4 T7 Y. j
WScript.Quit(); 9 R. k4 m7 k- E. S; B
} . j* Z+ N/ M" L2 A* i( l
' W" d+ h) X1 i, P' B/ G1 x
try & _' v! z- e7 I# D9 v7 I" ?
{
' j/ T4 U4 D) I* r+ ^& O1 K simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
% e3 Y; }/ q& X r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ( e+ }9 _; e& `* H. l- ^8 V
if (r == vbCancel) 6 y' w* \3 y) G4 D+ P
{ 0 p& _3 W7 L0 y+ t# D
simple.CloseModel();
% f4 b9 `: a% z% r5 y: X WScript.Quit();
/ v, g6 F8 b2 J( U. y2 S( v5 k& a }
" {+ `, U- D+ J* g1 B [} ' Q2 _ ~: i/ D, |
- U" p; j) Y8 ]simple.StartSimulation(".Models.Frame.EventController");
3 V) Q" G" O, P9 P
# r0 L/ R; ]* p v! F& ^: fif (simple.IsSimulationRunning())
/ U2 p* d9 x" K) }; `: S% L! S WScript.Echo("Simulation is running!"); , @9 ]- s! H. ?5 `5 O* i" y, ~1 e
. }9 I9 R, V# C9 o% W! z// Wait until simulation is finished . X- S' H* h: t* e
while (!Finished) WScript.Sleep(2000); / T" I* N; X P4 X1 Z- F' R" O
# d" @6 }0 m, Q) lsimple.CloseModel(); # ] `) ]" S3 V. o9 O
simple.Quit(); . r/ o% z: I. M7 ?+ K+ p" A
WScript.Quit();
+ W; B: g8 }& f, o. a5 c
L+ u1 `# P; ^& t% U
A& m/ n/ v. r: g% J# F1 Lfunction RemoteControl_SimulationFinished()
# s9 Z( K/ W+ Q{
- `2 T ^) R, i1 b WScript.Echo("Simulation Finished!"); |