Example of a JScript
; s$ K& ?8 S2 t/ x( Fvar vbOKCancel = 1;
/ f6 i" Q% V/ b; X1 f& x1 Ivar vbCancel = 2;
% L1 }9 g F" T( @var vbInformation = 64; . G; Q+ [" ?- G2 o0 s, Y0 L
var Finished=false; ! j/ [9 s, U9 \" d0 X' e5 z) \ O
' O! ~) m5 j( b1 s4 }7 P8 C9 Lvar WSHShell = new ActiveXObject("WScript.Shell"); " O" B6 N, A# y# M* @+ o1 p
5 t* n/ v ?/ _ X
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
5 Y1 u+ R4 f1 x# q
- [0 A8 H7 w- W0 b" s* R) n. Dsimple.SetLicenseType("Runtime");
% p, Z, o# i S5 y5 j3 Q' ~ 0 N- S+ S6 |/ x3 p. i# W) S
try # u9 e8 T5 l6 d
{
% x+ Q6 X) o! u4 t" I // Enter the path to a model file! , Z, r/ W2 \" Z$ z) y
simple.LoadModel("C:\\Models\\Test.spp");
$ K1 e# n" M' t j, @6 H: z C6 F i}
" O0 X5 q0 D! ^( C7 Ccatch (e) ) e% `* D* u# J
{
/ P1 f3 t1 a# F3 ~1 \5 a( T2 h) f+ ] WScript.Echo("Could not load Model!"); 7 o6 Q0 A* @3 \) Q5 W
WScript.Quit(); 6 d6 E4 p& W) u$ d& e
} ( O' a# t2 a7 ?, ~4 Y+ B! N
7 T1 O3 _$ o, n$ C5 ytry 7 s: x1 F: s C8 `; P: c, K- J
{ ; z8 _( |3 O7 \. p/ q& @3 }' _
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { / O0 T3 m, s! g& D7 h" l
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 8 P1 G. z' ]* D
if (r == vbCancel) ( N/ [/ d) X0 N$ v6 g% C- A
{
0 j/ ^* `( A; ] simple.CloseModel(); 7 M4 l0 o& I- |1 M
WScript.Quit();
/ E& M/ L8 }. ]+ }) n# p9 K2 C, i }
5 ]9 z3 C! P( }& X' v} . m! G% X: O, l6 c s# `# B! S6 }/ n
& |& u* A1 W/ N7 v
simple.StartSimulation(".Models.Frame.EventController"); * \3 {# Y9 T( n
6 D. b* I! L+ m& j: [5 {3 }$ U( K
if (simple.IsSimulationRunning()) # n# N' S9 o5 Z) T
WScript.Echo("Simulation is running!");
% D" T% ]2 R4 \4 W4 r * c- }2 f- S$ j. I: g( P7 b
// Wait until simulation is finished
, Y- l: r, s2 E& g2 U, ~; Jwhile (!Finished) WScript.Sleep(2000); + i3 g& J/ z: y: ?2 {& a& [6 s
; i. C: E) }8 l a
simple.CloseModel(); 6 p4 k" S+ e% r. d# o+ X0 l
simple.Quit(); : O- I Z& A$ D2 m! I3 j4 c8 f% ]" G
WScript.Quit(); $ h0 N1 z' r$ X8 B$ |) \- S D
8 R9 I9 V2 Q7 p2 L 9 L! ?" U6 p' ^' ?% U) t+ D- \$ G9 Z
function RemoteControl_SimulationFinished() 9 M1 X7 f* A+ G: m9 q5 B
{
; ?3 C! `0 ^5 N WScript.Echo("Simulation Finished!"); |