Example of a JScript
: K4 R) K' Z0 x6 l: tvar vbOKCancel = 1;
6 z! L/ P7 X Q/ A. L# j) lvar vbCancel = 2;
6 L1 }' ]9 h4 @ k }& B! Wvar vbInformation = 64; 8 C$ f: m2 r: ~ s' @+ z
var Finished=false; ! h% `& o5 T! ^. C4 S
" d% }1 l/ o6 \. a! p6 U/ |* dvar WSHShell = new ActiveXObject("WScript.Shell");
: k1 f0 x2 C4 D
' G6 }; o+ M, k2 hvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
1 N9 D' J6 _; C* r0 r 5 F- Y5 R/ @; [2 c
simple.SetLicenseType("Runtime"); 3 \$ s/ U& y& H/ C$ E5 B
# I- ~- B* g- T- U- K, t* A. Wtry : i- {! l4 d6 @# c) h
{ % N6 X2 i8 B" {, [7 q
// Enter the path to a model file!
% M( D+ \/ e9 F4 v simple.LoadModel("C:\\Models\\Test.spp");
0 P' ~. `% n a4 u0 n* `) O}
3 C, Z: i3 G1 a5 E- X D2 i5 ^" Icatch (e) + V6 J. H* V- h: a# r5 D
{
3 f0 l( C6 _" @+ \ v" E2 [ WScript.Echo("Could not load Model!"); / z3 S) M2 @. p4 S, r, R2 t
WScript.Quit(); ; {( x& }8 f1 T
} ! c7 k6 }1 c8 @7 N8 L) R( [
# H. D8 v+ m( Z; c( stry
' W; C- n: [( L1 F% }{
7 O# W( J% |% R% `( z simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
: d0 m/ R. [) [* Y; w0 W/ p% O r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
# d4 c7 B- y% ]1 R" T if (r == vbCancel)
0 m" q( M8 a& k i2 I) ^ { ; N& M0 y6 }. P. z9 ^! s
simple.CloseModel();
5 G* o* |; B- f/ ]8 _ WScript.Quit();
+ ~5 c# Q& X; V- D/ z }
6 l, p9 X8 d) H# [- l/ r} , ^$ N- O: a* V: I; t, e- [! ^# d
7 B$ }" n1 a* }6 q" n
simple.StartSimulation(".Models.Frame.EventController"); # P g, |6 f2 G S9 {# e
f$ X7 F$ `, K2 S5 g6 U9 T
if (simple.IsSimulationRunning()) # H$ E' ?4 C5 B$ ]5 X4 p" e
WScript.Echo("Simulation is running!"); , q2 x8 K( N$ O, `
* ?$ x5 ?% ^5 O// Wait until simulation is finished
% L. O2 m# _6 g iwhile (!Finished) WScript.Sleep(2000);
6 [% z6 L( R% F/ d
4 X' N9 A& i7 M7 nsimple.CloseModel();
2 |. l, |- m f; nsimple.Quit(); 0 c5 S2 H( W$ H
WScript.Quit();
" w6 E0 B4 Z: \! q
2 B( I8 T% M- F* u4 I S
; Z. G: ]1 ?4 D: ?9 g$ n Wfunction RemoteControl_SimulationFinished()
6 z- {5 I8 O) @' F& {{ 3 T z! D, @* X' g& d2 L5 M9 Z
WScript.Echo("Simulation Finished!"); |