Example of a JScript : [% Q0 n% ~* @4 G% g
var vbOKCancel = 1; ( t2 z6 v2 C' N% X& H
var vbCancel = 2; ; e% v8 H& a$ y; P
var vbInformation = 64;
+ z6 X$ S6 p5 W( Bvar Finished=false; ( N' W: {7 c K
' m5 W) A: ^7 |* h, t0 vvar WSHShell = new ActiveXObject("WScript.Shell");
7 M) ~ ?' E, W+ T% P
" V: V" J% A, g Y i* \* wvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
0 H: ]! R& l: J, K$ }! z
- k( e3 q# a V( D) [( m" Z5 Isimple.SetLicenseType("Runtime");
+ B+ j: C# w, v9 a
- ]1 A& r& w+ j% ~try 0 D' A( {$ g5 [& x) t
{
. i# b3 @, K2 S: n% q // Enter the path to a model file! ' s% z7 K8 A% J& T: v* @) ]
simple.LoadModel("C:\\Models\\Test.spp");
/ f% L2 x. z9 l. U0 O0 m} : C; K$ h1 J3 F. Y6 P) l, d
catch (e)
2 H5 j. u: @* [" a% |0 L0 V; i9 J4 g$ e{
% m/ Y! h' A. ^ d+ Q) h% X# D) V WScript.Echo("Could not load Model!");
$ I% P' v, S" @, b+ j WScript.Quit(); $ O0 c% \1 u, D) x4 I8 {6 \
}
( h- e9 Q( t+ Q% b% y) a ! _0 m3 K9 h3 C# z
try / \+ p8 a, H! n2 J
{ 8 [2 e* P& J6 h- t$ a5 N: X
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ( o1 Y( V7 _/ U: d7 d
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
- y+ @3 e/ K) D3 Y) V: o' f% `: F if (r == vbCancel)
m; @$ V7 s5 j' O7 z {
' M( }+ p1 P+ Z9 H9 ]2 I simple.CloseModel(); 8 `' b) D, d; X+ d# e$ A3 \$ `6 M
WScript.Quit();
! L0 E7 N8 | t1 o1 m }
6 Q2 |" Q( a3 q d- [4 d0 \; S}
' t" M& a( V N1 y, t . F3 p3 l* ~* R8 a+ `' m' C% E6 n
simple.StartSimulation(".Models.Frame.EventController"); 8 j) x$ \3 q8 q8 n2 y2 g/ }6 ^
6 B9 M- b8 z6 x( G" P/ h. Bif (simple.IsSimulationRunning()) * V; N' o1 e3 x8 V
WScript.Echo("Simulation is running!");
- t4 \$ O" D. @
* o9 u! c* x% \. ?# A7 L% B// Wait until simulation is finished ; @: e* N& }: `8 g" d+ X
while (!Finished) WScript.Sleep(2000); , d! O: u! ~* {8 x9 M9 P
5 v Y9 v# W a& s9 K! {" q2 A' N( ]
simple.CloseModel();
6 k, R" ?6 I) H0 Asimple.Quit();
% l& N9 J% ?2 S3 zWScript.Quit();
2 t( ?8 W9 O- Z P& b7 X , o6 o# G- ~5 k+ \
& W- k" o% Y) h+ A: \function RemoteControl_SimulationFinished() ; ^) G1 ~; P( J
{
7 [0 x8 @. i2 N0 D3 ^ WScript.Echo("Simulation Finished!"); |