Example of a JScript 3 a( c: E+ L1 f* K5 q7 u
var vbOKCancel = 1;
3 |, w& F+ x, A3 Vvar vbCancel = 2;
; y6 M6 {! _- t. T( A+ Hvar vbInformation = 64; 7 X& k: _& y7 u: W' G
var Finished=false; 1 x$ K4 q/ R4 L4 v& }; _8 @3 t
. U! ?8 d7 h ]9 v0 {9 A
var WSHShell = new ActiveXObject("WScript.Shell");
* a5 K& G+ I% D$ Y+ z% l j0 v ' B; z+ ^* P. D
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); & A# D0 U5 L4 z# N- T! t B
& ~$ m) Q* j8 t5 z! R3 H- j, h! h
simple.SetLicenseType("Runtime"); 7 y- v- R7 j! G1 w
( M4 g6 x7 {: ~: {; T% l5 ctry
7 ?% U0 u: `! i* h& y& s: `3 l2 x{ / Q4 P8 `+ g+ C- u# e
// Enter the path to a model file!
7 [% R( \& ?* _( M: j- l simple.LoadModel("C:\\Models\\Test.spp"); 9 u, T! A+ x w' C3 |& c9 X
}
. K* ~8 j; d% n$ M7 Dcatch (e) - S. [2 }4 h0 L6 v1 @/ U
{ & {" Z8 E5 B# }5 P4 t! X; [) v
WScript.Echo("Could not load Model!"); ! L9 Z' P+ F @+ E' l
WScript.Quit(); 7 o- S/ p, w8 `4 j+ ]9 x' v) m
}
/ m. b V% H* p' p: ?# `0 t 9 o% |- l: V$ L, t% D
try & E8 R; h: @, Y! d2 T
{
5 V, k% k* _$ L3 R' R' b1 c simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { : Q, u' D+ V7 a% ?6 i+ I
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ) {( I# ?) Z! Q" g
if (r == vbCancel)
* Y0 O' m7 ~+ K3 v2 W1 T {
% Z9 S" f5 o4 X* @+ F5 | simple.CloseModel(); . z7 D0 n& q, v9 v$ O
WScript.Quit(); 6 ]5 X) r1 J V" l
} 8 k5 b1 `" U f0 F/ X# N7 T
} 3 U- D* S2 V: J% F4 d" H- }- L7 j
2 d6 \1 E' d, ]! t
simple.StartSimulation(".Models.Frame.EventController");
, \3 `: n& Q- U R$ \7 f( k ! b. u9 v1 v8 Q7 k8 \2 j
if (simple.IsSimulationRunning()) 7 u! Y, ^/ [( t8 E- A# W, d
WScript.Echo("Simulation is running!"); 6 i3 V& F z! H0 a$ V( x* O
2 i$ A# w/ K5 `& \+ ~- \// Wait until simulation is finished
0 L9 K. Q8 o" T3 \# P$ @0 e8 n$ @6 `9 vwhile (!Finished) WScript.Sleep(2000); : U+ S! G! S Q& a8 f) r
" k p0 \6 e+ i1 d1 S. S3 hsimple.CloseModel();
0 ?+ I5 N" A( Z1 ]/ C4 Lsimple.Quit();
8 j; O! I) s2 b& |. o) y; WWScript.Quit();
9 i+ D5 V5 d+ [# [2 V$ J . O! K, c1 D1 o% a* r4 x
Q' |0 [8 m$ Z8 _' D& k3 k
function RemoteControl_SimulationFinished() 0 j5 A! x3 x4 S& W. N4 Q" A5 l
{
7 j+ s! \5 c! c7 s% L" m; V( d6 ? WScript.Echo("Simulation Finished!"); |