Example of a JScript
4 X$ @7 h' k! n: ]+ n Q* Wvar vbOKCancel = 1; " w, X" Q" n8 w
var vbCancel = 2; + u$ ^' V' ?0 r' P: G( p
var vbInformation = 64;
; R E+ t' C! l( T7 V/ y5 o3 z; z6 r. Rvar Finished=false; , q6 m& L3 S" N7 I5 |1 r
0 f/ V; K" Z% r7 `2 Y- i/ b0 n
var WSHShell = new ActiveXObject("WScript.Shell"); 9 q" z* j% P/ ^3 ^# Y
5 e& Z8 w. W9 u4 c7 `9 U/ g, W+ L
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
$ S+ @) Y2 F% d6 f9 L; U" { M
- G* P( T+ u7 a4 w6 ]& o; xsimple.SetLicenseType("Runtime");
% b. m; C) q7 a L; ^, K
1 n) t% L( e, U' [# L0 G7 Htry
$ `1 U# ^) k& E% T. _5 n% P{
- ?# _( x/ C+ u: S: F% t // Enter the path to a model file! ) [. e& A% b8 h( r% f1 ~8 P1 U
simple.LoadModel("C:\\Models\\Test.spp"); . T7 v# ]. L* z# d
} # @- k! a% p- L5 B
catch (e) 8 v3 v; S8 H* L* w8 m8 @
{
, \. @8 L4 f" D0 a. r: |) X WScript.Echo("Could not load Model!");
6 \0 A- S$ n1 O" ~2 o, L( ^ WScript.Quit();
: D* Z0 s. r2 P} 1 a* N* X: T$ L# ] l7 F+ a
8 t: s6 `" a9 I& S3 e% X& f& x
try 2 l- [ O. Y7 s5 q
{ ) b4 R, [7 p, V# y$ a% \. G6 ~: h7 p5 K
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
6 `8 B) Q) V3 @ Z1 c# v7 m! m r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 8 G) D. ?' Q# r7 z' G
if (r == vbCancel) 0 F t" s" F+ V8 c! d9 I
{ ( Y7 N- b. E3 w/ }8 ?2 @
simple.CloseModel();
, v6 u! g2 p# H; L. j0 l! ` WScript.Quit(); / f; a2 ]% w" H: P3 I
} * k7 C+ ~0 o& M$ a8 U2 p5 F
} : w% c6 } m. ^/ T" O% C- H
( @8 U& J2 a( l: z6 o1 Ksimple.StartSimulation(".Models.Frame.EventController"); 0 m" p% U2 V7 P1 G* n: H) s: T9 ]
7 r5 c7 ?9 m4 xif (simple.IsSimulationRunning())
. J1 k. G# p `+ t& O: R WScript.Echo("Simulation is running!");
* P' g" U' k+ |4 k3 Y
+ G, d9 G. h) l) o/ h// Wait until simulation is finished
) G0 L) E- B5 s9 w" `while (!Finished) WScript.Sleep(2000);
* s5 b) K- K7 |% x
& c6 M+ k& I% m& Usimple.CloseModel(); a, D- o6 K) x. I3 Y; Q
simple.Quit();
9 l+ U- Y3 A) D6 X' j8 hWScript.Quit(); 6 N7 B+ J- y5 G. y$ B
. J% }7 P7 K! x9 }# b6 C # L l N m& \% }, |
function RemoteControl_SimulationFinished()
/ t2 I1 D, ?2 t8 x9 Q5 I{
+ o, H# T* d" I$ g, m V* B WScript.Echo("Simulation Finished!"); |