Example of a JScript + F5 V0 j9 T6 g4 `: Y4 U6 d' J
var vbOKCancel = 1; * I( \+ r: ]& r# G0 F
var vbCancel = 2; , X5 j/ Q* y+ q2 M# g
var vbInformation = 64; . K0 ]" }' H! A) \7 ]
var Finished=false; % e9 |- @& o! o6 h+ i# T
% {$ ~: J1 G" E5 Fvar WSHShell = new ActiveXObject("WScript.Shell");
5 h9 U! ^3 F5 D; l
" w' t$ t1 o" j( X% d% O/ n1 V& Cvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 1 D5 f" W; c2 w$ n
7 p R) \7 M( Y9 c3 V
simple.SetLicenseType("Runtime"); , ^: t$ a( @ W( W
) Q1 \0 d1 j2 {. Y5 y d2 ]: ?3 R' n
try
% Q* p, |! m+ r% a6 y{ " S* k O% K! @% a# U- M4 v
// Enter the path to a model file! - S1 K" O9 [- J
simple.LoadModel("C:\\Models\\Test.spp"); ! ~$ `2 K* V. T" l
} 1 E6 ?* K, y6 ?- G" c
catch (e)
2 c, V" H) }& P9 e* _9 m. @{ ) m6 w& d, m ^$ K4 t# n9 O
WScript.Echo("Could not load Model!"); 3 a0 c% |0 w: T" M
WScript.Quit(); 6 i9 ~' t0 {- Q5 t/ U' ~7 S. M5 r
} & A0 }6 V+ [. l. S# r) L# ?8 [9 Y
" J/ w a, n4 _* y% @/ J9 I2 U9 jtry
V- v% ~( S- E{
( ?: Z& q! H+ W! w3 P% w simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ( Q9 S" A+ d8 y& ^. F4 y+ g' J& S
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ' N; C$ @0 e" n, f7 n( C
if (r == vbCancel)
0 U" h1 x3 ?1 }0 T* u$ B- ? {
& v1 o# ~( O0 K1 @: w1 Q4 }( b simple.CloseModel();
1 `" y9 X" p, v" D) U6 @' v) K5 L WScript.Quit();
/ I5 V- G. v# g q$ B! c }
% Z! x7 v* o- f}
0 ?1 p. I2 W) p. F ! O1 [4 s3 u3 O+ y& M9 w3 \1 U
simple.StartSimulation(".Models.Frame.EventController");
# ?+ L+ I/ y7 z) a! q' ?
8 R2 B) K, n( v) t }if (simple.IsSimulationRunning()) 3 A6 o6 c. [# [' }
WScript.Echo("Simulation is running!");
+ L% _' q" C0 @ ; K9 z; `7 z+ x5 @9 z
// Wait until simulation is finished
" p$ u) S; E0 f4 n; Dwhile (!Finished) WScript.Sleep(2000);
) C1 c |% D% w4 C( e% y# R - w# B+ F A8 ?
simple.CloseModel(); / E1 u2 Y# _3 ^0 h& U% ?- G
simple.Quit();
2 |, ]9 I4 ^6 [, r9 ?2 D$ lWScript.Quit();
! S' |: ?5 e: S; h% `
$ Q# q; D {6 n" x/ h3 F7 I8 u 2 m: Z6 S ~9 y5 `% K/ V& C
function RemoteControl_SimulationFinished()
* g$ |. `9 S7 ?' l, @: ?: c{
) t3 ^/ x; P; [" J; @ WScript.Echo("Simulation Finished!"); |