Example of a JScript
1 J$ A. K" J T: @4 xvar vbOKCancel = 1; ! I6 j, R6 f" Y2 K" {
var vbCancel = 2; % z% r& T6 {) i3 H! C" @5 h, I
var vbInformation = 64; ( P! r9 O( L K+ c. w; I6 P
var Finished=false; ) |2 I C8 b% V! x, B
6 l7 W# {! ]. E! Q$ T8 ?var WSHShell = new ActiveXObject("WScript.Shell"); # r4 E8 f+ A6 _& }( H+ g* V) v
# a: k$ d9 G/ J" ^. J) w: L0 t) K6 G- Kvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); - }1 e6 S3 E6 }4 g, P2 Y
4 o& x8 m& T4 T# n
simple.SetLicenseType("Runtime");
1 j' O5 W3 H: Y; s* t! d ( n( g" B5 D2 t$ N1 U
try / P/ p g7 v) b
{
% X9 t4 y# c+ D" \2 U9 t // Enter the path to a model file! & h7 A' T1 y# w9 [- L
simple.LoadModel("C:\\Models\\Test.spp"); / b* C( U% P4 p
} # B4 R; D# r$ V* f, q4 h
catch (e) 6 U; `" a; T6 d" |4 Q
{ : B# J6 K# S- o
WScript.Echo("Could not load Model!");
9 b2 }7 o% \ C" c; L5 H WScript.Quit(); 1 [: p( h+ a% ~# \5 L
}
. a1 L0 K# Q2 h; H n 0 w' x& G) G+ ~
try 5 J& R+ y, Z. C6 H
{ $ ?1 D, ~1 g9 a5 d. D
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 0 w2 r! M; Q( s
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); f" _+ @& B6 S& {
if (r == vbCancel)
1 ?! F3 Q+ x# U, ] {
; \! r" y0 K% \! q3 z$ j& \+ [ simple.CloseModel();
0 Y2 D: n5 J/ a WScript.Quit(); ( A- R3 X' v* g3 D4 M7 V
} 3 U9 \0 c9 a7 g6 ^/ R- ]" y
} ( T) r# N5 i1 ^3 R6 b
7 N. G6 N- {0 Jsimple.StartSimulation(".Models.Frame.EventController");
8 F ?( J# ]2 P; a0 G& Y
1 d& f# x# c; V+ ^6 v1 _if (simple.IsSimulationRunning())
1 E$ x, k( M- x" G- T( Q& g WScript.Echo("Simulation is running!");
- B5 [9 g; x6 G0 i * b, O, }; z+ G) p+ L4 e# @! M2 _" N& ?
// Wait until simulation is finished
" a/ ]% l" u& Z" x$ D0 S3 ^while (!Finished) WScript.Sleep(2000); 7 `- N6 ^4 C- q1 u
* I) w/ Y8 ?' {! ?/ l3 s8 |simple.CloseModel(); 7 Y! L) M0 e4 v7 C0 M* G
simple.Quit(); ; x- X" }* T e# ~- |/ d6 P
WScript.Quit();
2 s, \9 h( @* l# m: h& j3 X5 ~- q: r
9 w) [" V! Q2 _5 }1 H9 c 1 P; ]5 \1 t2 p7 `
function RemoteControl_SimulationFinished()
' A" p( H; V, V! g/ r7 }7 K# v{ ! D3 d& b0 H; i3 h* _- e
WScript.Echo("Simulation Finished!"); |