Example of a JScript ' i8 y3 O9 [- K
var vbOKCancel = 1;
7 c7 |( j2 J4 Ivar vbCancel = 2;
; D* s- }" J, S' Z( Gvar vbInformation = 64;
) h# k# H2 B# \+ x: m; [var Finished=false; 9 \+ w. l- p3 G7 ~# N" I/ H2 F! i
; v5 |2 m. y/ Z' X3 B. a
var WSHShell = new ActiveXObject("WScript.Shell");
' }, L P* Y& n8 _ q, e # h3 t4 t. e) ?) V2 y
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 4 `# {$ m& M7 W1 f* Y
3 z! [. p0 t; {4 g- }( ?) S7 n0 x
simple.SetLicenseType("Runtime"); $ K% z# d- m3 P1 R' X
. Y% l U9 |5 A! O% O2 Ptry 6 R0 l% ]4 M4 f9 _" U, d9 o! p8 ?3 y
{
8 D `5 ~5 z5 h5 V6 ^# m# r( h // Enter the path to a model file! 3 q- f. i+ V$ U
simple.LoadModel("C:\\Models\\Test.spp"); , F5 `- L# A" ^1 o. X) F* w. i- U
}
. F7 ? P( T* n# ~: D, Kcatch (e) 3 R% H2 a; v z
{ " h; g! ]1 V% X: E% E+ r, R
WScript.Echo("Could not load Model!");
1 E0 {- K$ w; B. x) H% m WScript.Quit(); 7 {1 T. m2 N, G3 ~6 `7 [0 G
} * W6 v- D. `: j
+ N- D1 I" L; I. X9 J
try
0 m; H2 |, ] l8 e/ i* \* W{
; I( l( u8 B6 o( Q7 ?* w: T$ \ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 9 c9 w, N9 `1 q0 z6 V
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
1 {5 a9 C' P7 U! |( v if (r == vbCancel)
# ^ X) k( K# x% L' | {
b* |, W5 Y6 }# w simple.CloseModel();
. ^5 _2 U8 U! F2 b) @ WScript.Quit();
9 ?1 c5 w& E$ c } 7 e$ S7 D/ w( k
}
1 q1 {4 G% M" o6 t/ C E, r * x1 z7 y' w5 `4 K0 F0 a, o
simple.StartSimulation(".Models.Frame.EventController");
" Q T- c: ~! D! n" `2 Q
9 B7 r9 F, u/ x3 t7 oif (simple.IsSimulationRunning()) u4 Z) b: ^+ y4 O% T) {/ T
WScript.Echo("Simulation is running!"); . h5 P% A/ N" k8 u' K, R+ Z
5 `" W$ [2 V, M// Wait until simulation is finished
4 Y; w3 {* m+ n: J! k3 Kwhile (!Finished) WScript.Sleep(2000);
2 P7 v* E( f$ I) Q( M
; m1 v0 ?2 v6 h5 T4 g8 N, lsimple.CloseModel(); 0 g/ `$ N2 }+ G: D3 {! k& o: W
simple.Quit(); ' c# K# r; t: H' O2 `1 I2 r1 S: l7 G
WScript.Quit();
9 j* T9 ]2 Q" @ $ c Y6 V4 t9 J8 [9 M
) ?4 X! }2 S z2 x3 Cfunction RemoteControl_SimulationFinished()
% K+ P8 W+ a$ t+ ^; r7 }. p' _: P6 |) `{
9 e( a/ i6 D% u0 P, v/ I WScript.Echo("Simulation Finished!"); |