Example of a JScript / O+ z8 \9 z. l# h/ L# I2 G
var vbOKCancel = 1;
% r$ S, p' ]6 x$ Vvar vbCancel = 2;
( W7 @# |6 M/ |1 J7 k& Z" o% @var vbInformation = 64; , y5 b8 ]+ Q& z+ T2 x" m$ F
var Finished=false; ! ~9 q0 t% }* ^9 w
* J6 t4 B9 n" K0 F8 a1 ?. [
var WSHShell = new ActiveXObject("WScript.Shell"); # D) w3 K h( s! Y, i/ s$ T! Z7 C
; E: y& q7 D# H1 d3 svar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
+ Y) e& [9 v2 s8 U
& Z9 [% X+ I: N7 Rsimple.SetLicenseType("Runtime"); " E$ H: ~4 C7 ~- _
3 J$ g9 X$ c: d9 Ktry 0 w" P3 ]7 Q) j& O: Y4 ~4 a
{ 4 v3 q1 k* ]. \; E5 p; K' W
// Enter the path to a model file!
' ?7 D# T* n, h0 ?8 N simple.LoadModel("C:\\Models\\Test.spp"); % ~- x& p* N. v* ~0 }1 i( n/ I( L" b
}
; a7 T8 O# [5 z$ t6 s+ a3 mcatch (e) $ f! r1 Q3 t* c7 {' I
{
8 ]- i; R! O6 ^' w9 T/ g WScript.Echo("Could not load Model!");
+ `4 e2 ~! }8 G WScript.Quit();
% x' R6 S6 z) y+ ]5 m: ?/ ~}
3 _6 v D* `9 R5 F$ \, |
4 V* \- x( a" U4 e1 B& Stry
; b3 d% D. f7 l1 [{ ' E: J$ f/ a, O G
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 0 m" M8 }- i& h$ i1 R( V: i
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 8 \/ @& d* E/ ~8 f) \$ X. l! G
if (r == vbCancel) 4 J! ^9 t( A+ H% v" H0 ~$ r5 J n
{
4 e: j$ C4 Q4 W& U) x8 } simple.CloseModel();
' u" p$ X0 u4 l9 J$ I WScript.Quit();
- N" d& ]: t3 p0 u: E5 d% \ }
' N- E: Y8 V/ ^, H! K: x0 Q% O u}
0 G/ [# l4 j6 W 0 q+ u! u" U+ f6 `# d2 p) ?
simple.StartSimulation(".Models.Frame.EventController");
% F% K+ w' D; i4 ~/ U - U1 w& {& o" E/ f# C$ t
if (simple.IsSimulationRunning()) 5 _( ]+ k2 ?* J& U
WScript.Echo("Simulation is running!"); ' \% f" B/ x% D f9 ]+ t
9 c' a. m3 a9 D! \
// Wait until simulation is finished . W2 F0 G2 `4 Z1 ]+ t4 Y9 w
while (!Finished) WScript.Sleep(2000); + ^" [8 B+ T' c* i8 N! n/ w
; h' | R+ z2 P: Q4 U, D# F, k" wsimple.CloseModel(); : p, G5 B5 N" L# y. l, h. Y: a
simple.Quit();
& e8 }6 B! Z' f7 Q- K/ n# N+ lWScript.Quit(); ) @- t; I! Q2 o9 w1 _( N
; z6 d" q: t- \* K& m
# @: \9 m# o5 Q4 s' Yfunction RemoteControl_SimulationFinished()
2 ^; ^8 |' ]& `5 @) }* S{ ' Y- e/ b% l, \/ O) a
WScript.Echo("Simulation Finished!"); |