Example of a JScript / _2 p8 c% p7 H7 d' N5 j( c
var vbOKCancel = 1; ; \( Q* G1 V" h- U$ k
var vbCancel = 2;
0 k& C' ?3 j. q( K9 ^/ N& Rvar vbInformation = 64;
, M3 b# ^7 J- Vvar Finished=false;
Z8 n* f! _% Q
6 x# w. r# E( {' T @$ i0 gvar WSHShell = new ActiveXObject("WScript.Shell");
' C* @6 B9 F! M" G" J5 G - N6 A& S+ j3 {& ]
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); & M8 }1 }$ e: U
8 F8 f) S# M& z& W7 @
simple.SetLicenseType("Runtime");
1 M4 B: Z2 c8 K% b Q
2 a/ d6 r9 t6 K! c, ~* stry
2 Z+ @# k7 P }) l) S7 e5 S{ ( g, \' G9 n+ H) |' y
// Enter the path to a model file! ; `) O2 P& N' @
simple.LoadModel("C:\\Models\\Test.spp");
9 E1 l+ ]. J: C" U7 ~! l. a. T} 9 i: ~+ C, K0 o+ _: {2 A9 ?
catch (e) . w$ Q( L+ d. U& n
{
2 Y; d: s5 H, h& g, I WScript.Echo("Could not load Model!"); : ^ `$ K- n( d! w+ k" D3 o
WScript.Quit(); ; }5 N$ h1 r4 m! g
} 4 M2 v5 O4 \2 r- T
# \* o5 D1 [! Q ]4 M/ t+ J( P- Vtry : [5 R" a9 ]' A# O9 `$ j
{ # z, T o( `( j# q2 T1 n
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
" P* d l# A0 C$ _% ?3 d r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 6 w3 d: |& j& `
if (r == vbCancel)
8 s- e3 g3 v+ o3 V {
. {# }8 `0 e9 R! i simple.CloseModel();
+ }$ L9 {6 t, m7 {: Q! D7 V WScript.Quit();
1 O( [0 Q( o% A }
; t" c, k0 _/ D} ; o. ^" g/ Y' k# p: R* q' e$ s- z
4 y$ c- l9 Q/ o* A
simple.StartSimulation(".Models.Frame.EventController"); 9 j6 u) e4 R/ V, y0 W- S
0 v& o5 T i+ O1 v) r, oif (simple.IsSimulationRunning())
5 H: C+ B# @' r9 ~$ P WScript.Echo("Simulation is running!");
) ^- h' C- E+ {% A
; I: J x, w8 a3 j3 m9 V// Wait until simulation is finished & N8 ], @& g- s! P
while (!Finished) WScript.Sleep(2000);
. I5 v% A! L8 }2 v& [ ^ ( |4 G {/ E f; @
simple.CloseModel(); w: w5 G& W! Y9 ^2 O
simple.Quit();
' j9 R6 W- ^- w9 h; y* i* yWScript.Quit(); : j1 t, _) N$ A( H
& }8 i- e' V" ~ : d6 ^/ r) d) S2 E( m$ h) ~
function RemoteControl_SimulationFinished()
8 }# j; z0 U4 p{ . K# [! k$ \9 Z4 v4 @
WScript.Echo("Simulation Finished!"); |