Example of a JScript . U$ Z# v! p M" i; j
var vbOKCancel = 1; 9 u" M# _% {. z8 m+ m8 Q/ L
var vbCancel = 2;
. c& e6 q; j g* Gvar vbInformation = 64;
$ A9 ^9 k0 t; ^: qvar Finished=false; ! o. ~$ j1 g( l( t# v) s1 {8 R
9 A) C2 T! j( | W" }* I X
var WSHShell = new ActiveXObject("WScript.Shell"); 0 n6 v6 ^4 P: g5 Z4 w
/ x! m; g8 r3 M4 @* m' k6 z% lvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 2 Z8 l( r. ~. i
' I. |/ L4 r. X1 N- nsimple.SetLicenseType("Runtime");
3 l, B! [9 y( x5 C8 w2 H
% U8 [- X; f. a. d: Ptry
: m1 \) \- R2 ]$ x- M. f( r: |0 q" o# u{
* D$ T& m9 @2 y% ^8 ^0 v, ^& u$ _ // Enter the path to a model file!
# _1 x8 \8 m8 c C# W+ O% y simple.LoadModel("C:\\Models\\Test.spp"); 8 _, k, l, y3 k+ l. u
} , S. \) `9 R: I/ I" s# ?, ]
catch (e) 5 Q6 \. r& p1 i( C! S0 N2 r
{
8 f* X) M- V9 C1 y4 b WScript.Echo("Could not load Model!"); ( w( D! v! h- J5 j
WScript.Quit(); , n$ Z; N0 i, A4 N2 D4 {
}
3 V; s( f7 [7 q& Z9 T" Z w
1 T- @3 G( h# ]- y0 q, X8 X- ]( otry 7 l/ q) C# |% ]; z
{ ( T3 y1 D0 G' n2 V
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 6 r& K/ \6 d7 g5 V( d
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
/ C5 f1 j. Z; V6 c6 I+ F; H if (r == vbCancel) t5 x: P% I3 Y Y4 ^: H
{ " j" n2 G5 Q4 f# S5 [# |
simple.CloseModel();
) _5 O$ c, R' |2 h WScript.Quit();
& P& g' U) R3 s( t' `) X3 A7 ` } 4 Z1 G4 e2 V3 i
} & r7 k8 U a8 k% k; [$ {6 }: d; P
) |1 `+ x& K; J, K. n2 asimple.StartSimulation(".Models.Frame.EventController"); % Q- R. \+ t4 l: D
3 l8 L3 d* ]$ H
if (simple.IsSimulationRunning()) & q5 j) t% t* f
WScript.Echo("Simulation is running!"); $ F9 R4 J6 @9 t6 d: t# D
+ k* r7 \1 s- N# X% H6 B- T
// Wait until simulation is finished ) K: r" r/ m0 A. _/ c
while (!Finished) WScript.Sleep(2000);
6 m$ H( o' r' ?7 M; }& E % s" T- F& `+ k' V
simple.CloseModel(); - z! d* v" V: Y& `* g- L( j
simple.Quit(); ' R$ H( C, X5 G2 v x
WScript.Quit(); 5 S5 M. t. k0 s+ k) M6 t
$ f4 l1 _+ {& T& E% X- q
# f U8 [. s8 z$ R8 A% I7 v5 Sfunction RemoteControl_SimulationFinished() ! ^# u b2 j" U s! D# T
{
6 {1 [4 q5 F! M) R5 N WScript.Echo("Simulation Finished!"); |