Example of a JScript . p& ^: c8 ]3 O$ l# B
var vbOKCancel = 1; ! U3 K* v' }; y) N5 X% H4 Z
var vbCancel = 2;
0 s1 U5 w3 R0 J" J: yvar vbInformation = 64; 0 Q6 h; c7 \: B" ^1 `+ r! n
var Finished=false; . ]3 I5 E. ^; h7 O3 o
+ U8 G$ Y' f/ I/ H
var WSHShell = new ActiveXObject("WScript.Shell");
: u0 C0 }# D& U4 R- o2 m
- Q; \3 N$ Y8 R jvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 5 Q0 V- V6 M5 P2 R& H
. L3 @+ X( b" R5 l- K# Nsimple.SetLicenseType("Runtime"); & b0 f* {' B6 F9 m: Y3 B! A D q
/ N. ]- h- W& \5 [8 |try
# x1 k. F* N# c! X7 @8 y# j: o" {- n{ + {7 t& u' c, g0 g5 O
// Enter the path to a model file! 0 V/ N; ?: \% `& e! j
simple.LoadModel("C:\\Models\\Test.spp");
, d! J$ O% I3 j} + X" ^* X! h9 X5 k, G& O7 S- W
catch (e) 6 S' g( c! t7 v
{ 6 D) N! d1 t/ I- n: X
WScript.Echo("Could not load Model!"); 4 f# u; d8 k# p, H: L+ u. @+ V
WScript.Quit();
0 P+ J- E. e% w; d}
3 l# i( A% n; F B' L0 S
8 j) Z+ e. Q9 b3 }3 k. ltry
: ~( c9 C& i, l* b6 F{ 6 Y6 `+ _# S9 H) V# S
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
5 z ^7 G% J+ O- Y8 m r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
, P% v) ]* `- {+ [" [- [0 g if (r == vbCancel) 7 O; Z, {" ?+ N7 J/ g
{
- a) [4 l3 w/ F8 k$ ~ simple.CloseModel(); 4 ]4 |+ ~) W3 V' S0 J4 D4 N) Z$ q6 O
WScript.Quit(); ' P1 Y0 h; }7 g# E8 x
}
1 ?# L; [1 I& \5 M# N) G6 H} % j8 e3 O+ K3 R2 ?
6 C; _( B- G/ `8 p, |! s2 J
simple.StartSimulation(".Models.Frame.EventController"); - z1 r" B8 X) \3 `8 Y" U
' a4 E) e& a) L
if (simple.IsSimulationRunning()) 4 Q( A$ T1 ~. u. F
WScript.Echo("Simulation is running!"); 2 z5 _8 q, ]3 J( c m/ T
7 g. N& I4 q3 d5 N2 \ z6 {# @; P
// Wait until simulation is finished
, b4 k; w, k$ J6 A' l fwhile (!Finished) WScript.Sleep(2000); 5 E/ F) W4 o' Y; D7 X- A
; a! d a. V) K1 ^/ S
simple.CloseModel(); * A# Q- s0 D6 y! L: ]6 I1 T, C- R
simple.Quit(); + d" H% r N0 ]% P/ i
WScript.Quit();
+ G* i0 t8 j0 A( A
) ?2 y, o' s7 l. ]# o
/ w$ l+ w0 }0 ^. k- V# S% S7 ^function RemoteControl_SimulationFinished()
" k a. s' R* x) F7 Y{
9 T* R: V h4 T9 Y' ?$ S WScript.Echo("Simulation Finished!"); |