Example of a JScript
( D% ~* A: w" J4 nvar vbOKCancel = 1; 4 l7 u- \. R: f
var vbCancel = 2;
9 E& m) m7 A/ X$ ?" [3 I6 O+ R0 uvar vbInformation = 64; 4 C) @: E4 v* u5 ?) |
var Finished=false;
2 Y1 b# U( P2 o" t. J/ L
2 \( H3 L- |+ S% E' V' \var WSHShell = new ActiveXObject("WScript.Shell");
2 D. S, Y6 y4 Q/ ?$ F3 X) L( m
2 l2 N/ r" r) E( Kvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); D! j) {& v% g9 b9 @: `5 j0 {
9 y) q: x1 u) y4 h8 k
simple.SetLicenseType("Runtime");
$ }* q& b# A) P( m' K% U : G8 |- P& y S4 v* W
try . H3 V0 V7 ^4 z4 x- V& H
{ ; W" m* H8 W5 [, z7 J7 n
// Enter the path to a model file! ) |* D) c2 ~# j9 B
simple.LoadModel("C:\\Models\\Test.spp");
6 [' P( a6 W1 A}
6 p; y( B: O! N/ pcatch (e) 3 t. n$ r5 q+ _2 S
{ 1 [- H- {" ^5 o8 ~, k) F
WScript.Echo("Could not load Model!"); - U. P* W$ X' @
WScript.Quit(); 8 k; Q# v; p& F
} " y* c! Q. W0 o, i9 V% \- ?) I
' O+ a# A+ _6 c# g' }0 k) [7 O
try 7 c8 w' k8 }) t6 x n4 b% V& c
{ $ D; N! v0 ~2 p' W+ C
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
0 d; r- Y% c) @# H4 _ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
, h0 d" `3 n! h. ? if (r == vbCancel) i3 c8 h! P" v9 E- A6 i0 s3 [( L
{ # x5 n/ ]5 c/ K+ {6 V8 i
simple.CloseModel(); : v' |0 b* D1 ]4 J& F* |
WScript.Quit(); * F% G Y; w" M4 X1 E
}
$ [% m9 I+ |5 m# C' x; q# ~' _. V' Y} ! j0 ^% L% Y0 S0 K. E& w1 M Q
0 E+ c4 p/ P. Isimple.StartSimulation(".Models.Frame.EventController");
: s' ]+ [1 k3 [7 a* L& t7 G) j; r
) g, [5 ^7 [/ Lif (simple.IsSimulationRunning()) 3 [. B3 {* }# a4 ~, v$ \. m
WScript.Echo("Simulation is running!");
& Q' ]' ]8 j9 Y1 E, H& R/ B9 V ( a! Q; o( l% ]- k% a9 i
// Wait until simulation is finished 7 D0 o* _3 u* b6 [8 n2 M4 X
while (!Finished) WScript.Sleep(2000);
# g+ X- @/ ^% t0 A2 k9 U & E _' F8 P8 Q+ Y- t
simple.CloseModel();
7 z& D4 |6 ^. Nsimple.Quit();
- `, x2 B( W& n4 Y, \- \WScript.Quit(); 8 b1 v- T5 W+ P1 I0 Z4 p
) @9 n9 y2 b3 L5 R! @- r; l
5 [% G$ k8 @4 z/ }/ ]function RemoteControl_SimulationFinished()
1 D H! r" m, l+ z# \{ - S t! a3 W+ w; D' K; {
WScript.Echo("Simulation Finished!"); |