Example of a JScript
8 I1 i: C5 z# Lvar vbOKCancel = 1; $ x; X* I8 Z& }* D) y5 L
var vbCancel = 2; ( _" t4 W0 X/ D& J/ \2 D1 ]* {! W d' [! K
var vbInformation = 64;
! O0 O/ m( |4 x: R( w2 J' `var Finished=false; # \8 V4 c+ }& h
* `( u- w: G! A+ b5 r- L& C; [
var WSHShell = new ActiveXObject("WScript.Shell"); ) k0 T$ ~+ S" G3 ]/ O
% D- l# \9 R' N# T9 I D
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
! J5 m6 |6 J& R, l
; F# `% J/ X5 ^7 U+ ^simple.SetLicenseType("Runtime"); % v f" _+ k7 k2 E; w4 {* T7 ~1 m
8 u0 `7 _0 n( c1 ?6 [
try ( c: Z# c3 Z! m; F3 b4 p+ q2 D1 ^
{
. |- a9 H5 w) D8 [) l // Enter the path to a model file! + n; O7 a# z! f/ z; k5 r0 U) |
simple.LoadModel("C:\\Models\\Test.spp"); 3 @6 d& i% E1 [9 ]" J( q H. L
} - E4 m% q: Z0 G( P
catch (e)
1 m' C. B, T9 d{
# m9 q3 K5 D: }$ D( ` WScript.Echo("Could not load Model!"); - F9 k4 j% U. T3 X" L( S
WScript.Quit();
4 C# `, v8 J$ n6 X7 T}
% Q( @ i2 v1 `, K8 U4 _
, y+ C$ g' R: t! a2 d, }try 3 M6 b% S# J/ d0 A
{ 7 k7 s7 U7 L' q& O6 n* M1 u
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
$ ]+ y3 k0 ` Z6 T+ q! C( P) V r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ' ~" ?" v$ a- v1 b+ e0 B
if (r == vbCancel) * I2 E% w( m. Y
{ 6 j( g2 F3 e9 b y' r
simple.CloseModel();
+ ~# J! P$ R" C) ~1 f1 n WScript.Quit(); . {) p# D! w8 a7 b, }
}
4 U( U) A2 p) o} * {" B* r+ i+ k
1 Q1 ~9 Y4 @: v# x3 b
simple.StartSimulation(".Models.Frame.EventController");
) s8 R3 N2 ?# _$ o7 M: v( u
7 e6 Z+ T+ p+ u; x* m& l8 {( yif (simple.IsSimulationRunning())
- h2 u. G8 B8 J) G* S WScript.Echo("Simulation is running!"); + ^% }& R5 P( W0 X
9 Y6 S5 Q; {. [& R// Wait until simulation is finished
1 S# S9 M5 {! s. Q' \while (!Finished) WScript.Sleep(2000); ) K8 ]' J4 [9 n- ?, i9 z9 F
: o s8 U) d' ?- Osimple.CloseModel();
7 o9 H7 f8 Q. ^* C" `4 ]simple.Quit();
/ F8 A7 t; N; D+ U$ f# OWScript.Quit();
: |4 z: `; C5 U; F3 x
: Y! b+ l0 E( n . ^9 d/ h1 B& G0 L* Y
function RemoteControl_SimulationFinished() ) t9 B1 q4 l3 v7 B- i
{ 1 [4 F- L( ]7 `, B
WScript.Echo("Simulation Finished!"); |