Example of a JScript
' b; \$ x/ A$ n+ f# [5 Y8 s8 r: ivar vbOKCancel = 1;
5 U. c; d2 @6 Q- c; s8 ?var vbCancel = 2; 3 u; m6 D/ U& g+ v. b8 P( Q z
var vbInformation = 64; - P; d* L0 Q$ K2 ~" l
var Finished=false; & r% S& c9 @5 F) G% m/ _2 n, I
+ R, ~# b2 Y s* v* Xvar WSHShell = new ActiveXObject("WScript.Shell"); 3 u, i- w+ ?$ v% u
5 a( l7 W2 O: C' }$ Tvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) t0 X, {3 T6 x4 ~ X8 o& R
: l$ S/ G+ Z1 v
simple.SetLicenseType("Runtime");
! P, C' t [, k# e/ _
- } Q3 ^+ }% s+ T; r) btry + }# G# V: i9 D" M
{ 4 x8 t- p- p O1 ]! _) \: X9 T, U
// Enter the path to a model file! 7 V1 E7 o9 R6 K$ d0 J$ {& u
simple.LoadModel("C:\\Models\\Test.spp");
, W3 W. J+ |' g9 m/ V} 9 x- e3 k; g) {7 I2 Z. S' _
catch (e) ' X# d- U4 p% G4 t4 p2 S
{
* H/ T- G8 A: V) |+ ~ WScript.Echo("Could not load Model!");
( c% A h" V8 n# m WScript.Quit();
; n% Q2 N( T$ M" h5 G# R; Z7 Q} B6 c" X, x2 X
% d& C9 x, i# Z% d L ^# {try
5 Y- v" ^. [ z- z7 l7 r{
- d3 c7 z/ v' W9 c: Q" \" S" H simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ' m- L3 ?0 M; |# h
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
9 h' Q. o. p4 Z" |$ e0 ^ if (r == vbCancel)
& q8 J+ S# n* x* e {
" n5 c. h" d/ ]( E: y" S( K( [ simple.CloseModel();
( \' _$ y% p' L+ ~8 E+ N WScript.Quit(); 5 @+ F, W0 \" `$ {) o
}
* \7 ~' l/ q' W, x) m# T} 9 L! k1 A# b) ~. ~4 @
' j" g3 E! J! S, S# {' c
simple.StartSimulation(".Models.Frame.EventController");
/ d6 j* ?; B5 ^
& n9 r7 R# c( B0 K* S. Sif (simple.IsSimulationRunning()) - g/ s) \2 u6 B& r# u$ E9 u
WScript.Echo("Simulation is running!");
% x$ \, F/ e4 b# B% Y! A4 B
$ g% x: N9 ?1 m7 C! @: i// Wait until simulation is finished
4 _1 R: j: h; f0 h. T. b+ [: Qwhile (!Finished) WScript.Sleep(2000);
' O) L1 u% q1 Q$ }
- O/ N1 M8 G, F- U/ q& Lsimple.CloseModel(); # X+ T( O0 c- X- a6 T- U
simple.Quit(); 4 h% e2 A$ C3 r) J* n8 d1 @
WScript.Quit(); 6 U5 Y( R3 b9 T; }0 j ~
5 j9 N2 _& ^7 h B( m- X; d1 P
( h; I2 {. h2 d" z& O; U3 [
function RemoteControl_SimulationFinished()
b0 _0 Y8 m% ~7 ?5 B# @+ J{ 9 X: |; s2 f. |0 x/ D
WScript.Echo("Simulation Finished!"); |