Example of a JScript
8 ~! m- T# L" u+ i: {5 w8 j7 ~) Hvar vbOKCancel = 1;
- r( y1 ]8 s% c" I( hvar vbCancel = 2; / e# n7 O) m2 X+ T5 d9 ~
var vbInformation = 64; 7 _" x9 D) ?% w( D
var Finished=false;
1 `) x4 h2 [5 C+ j; [4 ^
% O& n5 Z4 Q# Hvar WSHShell = new ActiveXObject("WScript.Shell"); " G3 }5 ^; w5 U% j1 F* K: y4 ~
# P. J% B- a7 R4 c
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
/ b! ^, b8 _& y2 g- V* l* H R 7 c3 \ h6 U; G% a/ G
simple.SetLicenseType("Runtime");
" r# x* \8 J. ]9 E) t' F3 z1 U - {0 T7 _: h$ g2 |% ]! H: L
try
7 {) b1 s" c& K1 G0 _{
+ J. g9 G4 D- g& k. L) _/ S // Enter the path to a model file! # ?/ I5 R: K8 j5 [! K$ L& l
simple.LoadModel("C:\\Models\\Test.spp");
$ `* T$ w, K9 O4 i( d6 k}
; U* I) _+ C# W& B% {: Rcatch (e) Y* I* T( T4 K
{ 1 Q5 O' F y# Y7 j
WScript.Echo("Could not load Model!");
' D2 ~7 w/ a6 N T) @& Z; { WScript.Quit(); % d* r o% R* S, a' r
} ~+ V; x6 B4 g7 B
" x6 Z* U+ o! f0 T: }+ K
try - ?/ J. S$ L2 h2 ` {
{
; B* S' K9 K: V/ y/ E% e! e simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
# t4 G/ m5 x0 H r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 2 k: u) h" ~6 ~: t8 N. e/ c. ~" C6 s
if (r == vbCancel)
' j# @% ?+ {# z8 |2 a; j {
0 e& y& _6 W. ?4 n \, O simple.CloseModel(); ; h/ z- I$ J, S/ V
WScript.Quit();
8 Y" v9 @+ r7 L9 Q* ]9 W; f& J } 8 T5 h2 v! J1 A7 W6 I# d* B- K
} , d1 i+ A: ]8 N, k9 V
4 c |5 j: S+ p6 \1 nsimple.StartSimulation(".Models.Frame.EventController");
1 I' n0 _: h7 T t& D4 k% ^7 A: g8 |0 V9 L! B
if (simple.IsSimulationRunning())
# U, U* k0 _ m( t' x! A Y4 r- Q0 \4 p WScript.Echo("Simulation is running!"); % `6 a: F: d+ X0 }4 y, L
% A3 t: f g+ I: m! p/ R7 p3 e& Y// Wait until simulation is finished 4 N# J6 a3 D# \$ [7 u: G5 j0 f- V5 d3 j
while (!Finished) WScript.Sleep(2000); 2 ~- z; ^& H& N
0 P5 I2 B) a1 nsimple.CloseModel(); / |) A/ I7 w! }/ G+ k" d
simple.Quit();
; F" |4 P0 \+ C/ U6 X- r+ OWScript.Quit(); + m/ h3 _0 E0 Z6 r9 l9 L
3 f) O9 t' X L# J* o
& o. Z; C* e+ B3 B( b% Tfunction RemoteControl_SimulationFinished()
! A, B ]& ?4 S" U/ K{
2 a9 s) c6 v# X/ s WScript.Echo("Simulation Finished!"); |