Example of a JScript
$ O' j, R/ ]. {9 F5 d! o6 Y5 g* V3 Evar vbOKCancel = 1;
$ u0 F" p) K+ k% Q& J+ b& g: }var vbCancel = 2;
2 Z8 s0 \8 m: @( Gvar vbInformation = 64;
% T5 w1 w/ e6 _# Q1 q, rvar Finished=false;
. @6 v0 }6 w% ?% u5 d
8 T, D m6 w9 I, E6 z3 v+ ]var WSHShell = new ActiveXObject("WScript.Shell"); ; t/ H! ^4 k" B& n; k( B7 \4 S
6 I8 Y0 y3 b" c# L: Z2 R
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ! l3 G6 O9 ]6 y% I/ W
( C+ N9 S- K8 J O: E; T' R; Xsimple.SetLicenseType("Runtime");
: B; {5 x) Q3 y7 @! l' S' Q1 F5 v1 o ' H' G% C5 |* ?( K0 S
try 1 J/ s, n. J. G, D- ^& p
{ 9 ?- {( B* t; t# C
// Enter the path to a model file! 7 k2 T4 u9 C; t. P+ u1 j2 K
simple.LoadModel("C:\\Models\\Test.spp");
2 |- p0 ^/ i. l# d; l) b) R}
8 b- G* {& Y/ K: U; B+ Tcatch (e)
9 I r4 h, J$ C0 I, {6 P{ 8 @1 E1 g6 v0 k/ Z5 c
WScript.Echo("Could not load Model!"); 6 I$ K( [; y; T
WScript.Quit(); % O7 S# a+ k; c9 ]6 {+ S- @
}
) T, A' u" y( _. E ( T4 Y$ m8 T7 ^% S/ y
try 1 M- k( J+ P. T, N4 R
{
X/ V' b! _6 ]3 y0 p simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { / b% T% e; c" v! `
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
! `. b: P. g1 z+ _& L if (r == vbCancel) : e2 P5 D% {: C7 e* ~ y, E6 l i
{ 3 f% H; j1 ^1 L5 C0 z
simple.CloseModel(); + }6 X' _" C6 V1 L, p
WScript.Quit(); / [. C( C: o# [* n. V* s2 ~
} ) T, S. Y% e2 `: G/ g
}
# R8 U f6 h) u0 Q5 C3 e % x. u1 j# u! O
simple.StartSimulation(".Models.Frame.EventController");
# X4 L5 ^6 h" C2 R$ J- C# }# t
9 Q* Q/ ?1 ^2 B# t9 g( X" C1 Aif (simple.IsSimulationRunning())
7 Q- H) \* m0 t8 J" j! N; [ WScript.Echo("Simulation is running!");
3 }- @1 g$ B" B) r+ I6 |
6 Q+ ^$ M9 g6 x// Wait until simulation is finished & r! P! a4 V$ K% @ k$ p
while (!Finished) WScript.Sleep(2000);
. d# o0 q1 N3 |. S" Q V 2 K! @3 ~- `7 `8 m3 u# p
simple.CloseModel(); 8 u! V2 T+ c- t) D& w
simple.Quit();
* b C" r& _4 H9 WWScript.Quit(); ) W& |& K4 Z- T* ^- @
0 J J0 P, U" v/ ]- v
' h5 Z- W! Q( F
function RemoteControl_SimulationFinished() ' J6 x$ |: B2 _/ p
{
& a5 Y5 W$ ]4 x# O' a WScript.Echo("Simulation Finished!"); |