Example of a JScript
* v0 B5 w, N7 Y, q) G" Z% D0 fvar vbOKCancel = 1; . Y* S8 K, X% q
var vbCancel = 2; * k* t$ X$ a* K8 y! m
var vbInformation = 64;
; n$ |( L5 Y2 x6 I! C7 M* vvar Finished=false;
7 S8 L' t A$ y / F* \: ]6 h9 t/ K& Y
var WSHShell = new ActiveXObject("WScript.Shell"); + Y" J# V9 H+ V
5 k' N% q: k0 G/ B7 k' z
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
/ L# Q& T8 \1 Y! E
6 A9 q; E# |( ~3 Asimple.SetLicenseType("Runtime"); & I# G5 f9 r f* g+ o" ]7 f N/ ]
$ N2 G* V- v4 | C
try
! |$ \& j% E2 R1 A; z, G1 J{ 9 L+ h' M! N' H3 a: l; C9 B p
// Enter the path to a model file!
4 C5 [# E, j; F$ o& B( r0 K, ] simple.LoadModel("C:\\Models\\Test.spp"); 8 X/ }3 H# j* c2 f0 d
} 7 }) [: o0 b% ]
catch (e)
; J) c1 R. x: a8 E: q{ * d* q0 X0 Q# o& o9 |
WScript.Echo("Could not load Model!");
; J0 ], q! ]. L" {& R% J! V WScript.Quit();
; i* j- ]8 s+ u$ c0 r}
) W% P& x) [7 D1 U8 Y 6 _% I5 v- n, r0 _ L* X( Z! k' _+ W
try
+ M) m! K/ c' Z4 w! J{ 1 Q& A5 w% N& K J: w" S8 d
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ m8 k8 t5 E5 o7 ? r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ( L1 g; @" `0 a$ B2 r, ?( R
if (r == vbCancel)
4 n9 R. |3 b1 e, W2 { {
; Z* `& H, A4 \& } simple.CloseModel(); % b) A/ x, ~4 y4 A4 _& g, B
WScript.Quit();
! [- n5 c& U* D- D9 x; q# I2 N0 [ } 2 ~# X& l: F8 d7 {6 g; a
}
0 J% ~, u2 x2 F$ C9 R5 q2 F - M3 ]$ k. U" X- j# L
simple.StartSimulation(".Models.Frame.EventController"); 4 Z( U& B8 ^3 o: n
7 g# R x$ m+ W H3 R& rif (simple.IsSimulationRunning())
; O. |5 q3 L: S, _- C- [+ @ WScript.Echo("Simulation is running!");
' c, W2 Q1 E; _
. u3 k. m/ |0 A6 u// Wait until simulation is finished % y+ c* r6 u2 Z- b, t
while (!Finished) WScript.Sleep(2000); 7 e7 ^; O, Z3 ~
0 `$ D8 r6 R$ o0 O3 Csimple.CloseModel();
! Z- F% R! Y1 M. `simple.Quit(); - A' _! h: h9 a+ C$ T
WScript.Quit();
5 F, W1 ~' w$ M1 A! J
& ~' {2 e$ M' T7 |/ y; P 3 u6 ~4 P6 x& R7 u, C% d1 Y
function RemoteControl_SimulationFinished()
4 f3 W/ S4 ?0 Y. P, C6 Z+ k! N5 n7 A{
$ C+ Q- y7 \+ Y, P) | WScript.Echo("Simulation Finished!"); |