Example of a JScript
) H, [1 y2 r q. ~6 gvar vbOKCancel = 1; 0 u- {7 {2 X# H, y+ j* h/ D3 T& ~4 w
var vbCancel = 2; ; ^$ }# q/ }) w4 S1 \
var vbInformation = 64; . }8 t; P# h6 e# e# \- H
var Finished=false; $ C) r, w+ ^% Y6 A2 \- _4 C
2 T# f7 O0 f2 |5 evar WSHShell = new ActiveXObject("WScript.Shell"); : l2 u$ e! K6 d2 g
) R% R* `5 b) v. L
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); , V( @+ g- T1 d# ?' ~* c! J: M7 Z
/ S1 [$ k: ]+ m+ l$ [
simple.SetLicenseType("Runtime");
' q' [- I G6 b" Z1 t) Q 1 g9 c2 `& M3 Y" c& s# B
try
5 Y; v" A3 ~! \) L{
: v' g( H6 W7 F3 f2 _. J // Enter the path to a model file! 9 q/ S& U, g7 d) }# ~
simple.LoadModel("C:\\Models\\Test.spp");
) y; w. z! g$ o}
- i! G$ e. l' R- Z8 w9 v" x Tcatch (e) 0 F2 }9 D l9 Q A% c) G# S
{ 2 } F5 G/ q- M
WScript.Echo("Could not load Model!");
: {5 u! [$ f3 z WScript.Quit(); - T7 S! F0 o8 o/ X& M/ Q) o
}
- c7 i' q* p. ]9 @" E/ }. T
# O L1 A& ~( ltry
: ~) j5 `( C6 K- o{
3 ^' n, ~: g9 E7 V simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ' I+ g X, s! H* Q$ m
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); / z; b; d+ G& J' c6 X) w! d) ^
if (r == vbCancel)
3 C" S0 N0 B# v& g( S7 ` {
; u6 a6 @/ M/ }4 P; W9 T i simple.CloseModel();
; R6 Q6 F& t" Y7 ^- s WScript.Quit(); % S" |+ G) |/ x2 R9 e: N, e( p( b
} 9 ]0 t' y# A0 w1 p6 D+ f; ]/ U
}
% m! e* F2 v7 y9 P. F2 C
# R7 v9 F0 y- b9 f: _, E& [ jsimple.StartSimulation(".Models.Frame.EventController"); ) x- j2 \0 m. S" g5 i$ m, L! A
2 X7 n/ h6 _5 Z( G) ]if (simple.IsSimulationRunning())
N% a# y' ?. s/ ^5 R- L- ~ WScript.Echo("Simulation is running!"); 1 y6 s/ |' S* G! [. W: y/ h6 a8 a
, B0 @" A' K G' X' H" O
// Wait until simulation is finished 6 m1 t; v# ^2 O- h
while (!Finished) WScript.Sleep(2000); $ X/ A9 T5 X0 O5 j3 q; a. @' D
7 h; y: Y- O, I) e9 r( ^simple.CloseModel(); z3 s$ C2 a+ h( G* b2 r
simple.Quit();
2 G0 U3 {" h9 y& V, nWScript.Quit();
; V9 s% j: c* a+ a / c6 t! r3 {. h- Y: p/ M/ d
/ K: H' W3 M* W! Afunction RemoteControl_SimulationFinished() 1 t. J* A& Y3 K/ o
{ * } G5 N* y) N% [7 j$ { F
WScript.Echo("Simulation Finished!"); |