Example of a JScript 7 @" H( ?5 j5 |/ F9 O. H
var vbOKCancel = 1; 3 Q& e |* ~+ @" o* k$ a1 R
var vbCancel = 2; 0 X, j3 k) b( `
var vbInformation = 64; 6 f1 h& h8 `" A9 a$ I, P) ]/ L
var Finished=false;
8 l. W- e# _) |3 v+ B 7 O o, A! K- o3 d! ^* ?% d5 W
var WSHShell = new ActiveXObject("WScript.Shell"); % r- o: h- \9 K/ v+ a& d+ O
N+ V7 V8 b7 q W6 q
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ( p4 M/ r- K8 [/ @7 W/ Z' A7 z
& d, @1 w& E6 h l' s2 ^ x* C0 tsimple.SetLicenseType("Runtime");
( J! b, D1 f# g$ ]" {
; S6 ?6 D+ k- z# `. d4 d& ltry ! U# U$ @+ P% Z
{ # a- {( \0 g% c' f; V0 s
// Enter the path to a model file! 3 @; y# W1 J$ x& R4 W) {% U
simple.LoadModel("C:\\Models\\Test.spp"); : b, T0 ?2 ~* _: |5 U R, @
}
3 {( \7 e& G( G3 Dcatch (e) + n+ m! _) N+ S6 V7 |
{ 8 G% z+ h. L; F" G* O
WScript.Echo("Could not load Model!"); ; B$ i! o& A5 k7 X3 _
WScript.Quit(); 6 k- s5 }7 w( s' I' p# v9 K3 ~
}
8 S6 D5 }* s- @' M
; j4 a9 G! @& Vtry 9 \, ], z7 C2 |3 F
{
! Y5 X, t9 L9 i; w simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { . X& ^4 U' q9 a4 y
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
+ h5 [* W, A( G( c4 S if (r == vbCancel)
: n2 [* N3 m& {' Z {
" m, ?2 G: Z- j) f! r \8 b simple.CloseModel(); $ `" {8 @, J0 s
WScript.Quit(); 2 ~- k- B$ E: B& b2 u( K/ m
}
2 M2 h/ N) q7 y: K2 p& [}
" j9 ] n+ X( J6 `- \6 m3 v - p3 q) q( W) y6 a6 K
simple.StartSimulation(".Models.Frame.EventController");
4 C: H0 R! s3 r* F- q. o" j , o/ A) p' \! r8 Z% N
if (simple.IsSimulationRunning()) , j: ?) j6 y: h' v5 B8 G
WScript.Echo("Simulation is running!");
) i0 i# u# ~6 e0 d; Q
1 x: t' W1 Z3 Y2 q$ e// Wait until simulation is finished
) ~6 I- K& x* y: Z, rwhile (!Finished) WScript.Sleep(2000); . I0 S$ X; z @: @
0 x8 C3 a% B A' j7 _/ h; L5 L% }simple.CloseModel(); . A- o( @3 O0 a' s
simple.Quit(); 6 {- d7 a f8 ]# @. x
WScript.Quit(); % ^$ i2 V: Q9 s, w; \4 d$ Z( H# D
, K8 z! f, s& [1 q9 s* ~& O8 m) p
& Z* t- D3 Z$ vfunction RemoteControl_SimulationFinished()
* x8 L8 n& W7 j{
! U. F g# T4 S2 D! h7 m0 M- z WScript.Echo("Simulation Finished!"); |