Example of a JScript ' k6 f+ g# [" |/ x/ [1 n
var vbOKCancel = 1;
# L& \2 X2 y6 q0 n# ivar vbCancel = 2; 6 `: _- p* ]2 h9 D0 y& e! a1 w0 |% S, u
var vbInformation = 64; ( }& X3 y6 E. w) z
var Finished=false;
8 w S o: Q0 x! o5 W( {
- p8 f j% S( R% S( yvar WSHShell = new ActiveXObject("WScript.Shell"); ) D" I G) I9 K R
, {& l- P/ D3 b6 s7 X) l ~% e
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); / k$ Z8 V& n4 p$ z6 p" E
; f" L# Y3 _/ ~4 b8 x9 h, ^simple.SetLicenseType("Runtime");
8 L' V7 Y- \; t8 O2 v! }
1 F2 p) M! r- G d" Ttry
7 T% |* l$ C2 q M$ c4 i9 z{ 0 H$ b4 \) n" w6 I
// Enter the path to a model file!
2 \+ M: o4 e" Q' m! U simple.LoadModel("C:\\Models\\Test.spp"); ; i3 F6 p# y$ @ x
} - S( s2 s2 O' u5 a3 P
catch (e) " J0 x- j/ l0 y* E, o
{ 1 k5 l0 v$ }6 T* }
WScript.Echo("Could not load Model!");
. R! O$ T3 g" f( Q( z WScript.Quit(); / n& d; M" u t, W# G
}
$ p/ Z1 S! G/ Y' @2 e- B) h
+ s }5 Q! G. b0 H2 `4 ~try & G7 S7 a1 R& f" z6 z
{ ! {& F5 t$ M9 w, i% R
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 4 ^" e" c6 v% B; _
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
. H. J, r, O5 ^/ M# y! ` if (r == vbCancel) : }0 W9 _* |3 u) ]& n) y
{ $ o v' _2 [2 k- W& g/ K
simple.CloseModel(); ! i! b3 |/ \" r% V3 r2 W& Z
WScript.Quit();
1 {) k$ ^" E9 g } " t2 T" q6 g) h; B
} ( E V! A& l& b, q
' L4 u) {" z, a/ }( o1 ?$ @" x usimple.StartSimulation(".Models.Frame.EventController");
' c( y3 j5 Z! {) [. w
, W; [+ S( I4 ~( aif (simple.IsSimulationRunning())
* L$ @, Y& s+ t0 s* p WScript.Echo("Simulation is running!"); , |# E e3 t8 P/ @' s3 M, J
! k+ b) ]9 ?" X% ^9 u: d$ X0 @
// Wait until simulation is finished
% k4 A" }" Z8 n# l2 U: zwhile (!Finished) WScript.Sleep(2000); ) ~$ k: j7 E2 `# X% U
$ T$ [' j& R% Y# [! q8 Ksimple.CloseModel(); ! c* p: ^4 s$ ^ B
simple.Quit(); + @$ t+ ^! j+ n: n0 N1 q) l
WScript.Quit(); 1 {7 `. y0 f$ w) z
& G$ V, q6 N7 s [) K, p4 i8 M D
5 }% f" q; m; Y3 mfunction RemoteControl_SimulationFinished() . G* G- m* ~ ^& Q" U3 B
{
# Z- ]3 V, C" ?6 W9 I, @# ^ U WScript.Echo("Simulation Finished!"); |