Example of a JScript
$ F+ T; a& A+ F& R7 ^% P' q+ _var vbOKCancel = 1; * l4 h& y; y4 w" P/ Z; E4 _/ [
var vbCancel = 2; / ]9 u0 [. J* }- _/ J
var vbInformation = 64; 9 x: a; M# a! b/ d- ?: ^0 y1 v+ v9 ]
var Finished=false; - W/ u: ~& t: v& w
* H/ T0 `% y. E+ ?! f
var WSHShell = new ActiveXObject("WScript.Shell");
1 f# w, |9 i9 l S! b$ P3 ^
" N: Z0 {9 k) l. svar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
0 O% ?2 w# A; J) V/ O: l
0 I# y. E! D- K' Usimple.SetLicenseType("Runtime"); $ { Q1 i% U/ A- i& f
0 c% c+ ^. | t! Etry 4 ~0 g, x+ |* z- A D
{ * O, H) f7 n6 J0 y0 g0 G" Q( @
// Enter the path to a model file!
; b# W- c! k6 g) [/ E* L simple.LoadModel("C:\\Models\\Test.spp");
9 E$ e ]+ J( e* N; j}
4 M$ p% E0 w, H" C3 Zcatch (e)
3 O) n$ L0 o* t4 t3 C% l{ 1 F5 h8 B* P0 c4 J7 z) A: t
WScript.Echo("Could not load Model!"); 5 S3 E9 h4 T9 J* R# a, M
WScript.Quit(); $ P, q" k3 A/ V( E
}
`+ K- s. e: K6 Q, t$ b( ^
' t9 k [! L: y9 z9 O6 Qtry
: r5 [1 t; r l, L# U{ * ~% M* k: S% x- F" A6 c: T
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
C. s# M/ Y9 O$ @3 [$ e6 e. N r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & c$ ^( H: s0 x0 m; t( A; X
if (r == vbCancel) 1 ^9 E, T& q* F: X( A
{
9 t0 x+ W% h$ i simple.CloseModel(); ; }2 L4 v6 i. `7 H; O7 J% r
WScript.Quit(); ]. }! v; g1 j- J- k0 \; ?
}
9 u: j% t. `6 J} ! u3 ]* w0 g. h2 ^+ V1 _
* {7 P: t9 C0 m0 d- C
simple.StartSimulation(".Models.Frame.EventController"); 1 O/ X( {& L2 y0 [
3 x* a3 d4 o1 p# r$ y
if (simple.IsSimulationRunning()) " y( y' M* r ]$ |6 g
WScript.Echo("Simulation is running!"); L' U/ T% A: ?$ W+ d# F A: p; r' T
' s* V6 k" T: f% Z3 D$ R! E
// Wait until simulation is finished
% m! O; [( b) rwhile (!Finished) WScript.Sleep(2000); 5 F' `0 {* n% \ {; M2 ^, F |% C
1 E% o9 j. E4 x$ w a
simple.CloseModel(); # U# h/ T* F! o
simple.Quit(); 3 \; N3 W B( T# G. q" Z. E
WScript.Quit(); 8 |/ M3 F& `5 Y5 p7 C5 s) y5 I/ I
5 b. K* Y+ L( |1 u. ~0 }
3 s$ ?- D" K1 G$ g8 k7 Rfunction RemoteControl_SimulationFinished()
$ X# j1 h( v$ d: s7 K* |( e{ . x! t" n1 _, j% a; u/ O: H
WScript.Echo("Simulation Finished!"); |