Example of a JScript
5 ?4 Z3 C3 r. l" u8 [) o% bvar vbOKCancel = 1; 5 L) f' B, G) I3 V. D! T' D2 g, o
var vbCancel = 2;
& D9 M& u9 u- @var vbInformation = 64; ( c% b8 U; e% y3 ~* q/ B) q0 @
var Finished=false; 4 j. c7 t; e, }) G. t$ S8 j
3 H% F- }3 U# ^: W9 m' Evar WSHShell = new ActiveXObject("WScript.Shell");
' o% f3 d' G2 `* y1 p# w: J ( J9 c+ a, h" Z5 c8 q
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); , g; t. V# b% S8 l7 q+ \+ q
( i5 W$ |$ q( _" {simple.SetLicenseType("Runtime");
/ q! O2 r6 B$ r
! b9 t9 B( ^. vtry
8 B7 f8 K" p5 c" f* Q. h* h E( m G{
3 C K- C/ V0 B6 \* g // Enter the path to a model file! o, F, X( v7 I6 J2 }
simple.LoadModel("C:\\Models\\Test.spp");
$ f# N- |) [$ ^/ T9 o}
( ?9 l5 B8 g5 Ocatch (e)
% q$ L( n) }$ W/ ]! L6 s{
3 o, t' J, u6 |# L7 n$ c WScript.Echo("Could not load Model!"); M3 p! D3 z2 V* R @! v" q. O
WScript.Quit(); + n) z+ W V, ?7 S/ I$ U
} p2 R& Y- c! z/ H0 h4 O* l8 t# M
1 Y: U: ?. a& W- e+ G4 Y8 e# e
try 0 a' k3 N4 b- ~7 o! c/ {
{ * l/ o- Z' e! X
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { : f; E! ?' [6 C! M" H/ I8 k
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 4 p% x" z$ i% [/ m2 A& U
if (r == vbCancel) ( @: {# n. ^3 \) i; c
{
/ Q, B4 f |! E: U7 t simple.CloseModel(); ) H- |+ p/ N d, l
WScript.Quit();
7 V; S$ w& {9 c ^ } , j! i8 |8 Q* W. D# ^% H
} ! M5 x2 Y3 E5 ]" Z$ B3 C; ]
, Y, \ T' Z. @$ G6 u. d" s# C# Vsimple.StartSimulation(".Models.Frame.EventController");
. @9 O0 _1 D; F* O9 y - ^& s9 J& s% {1 C9 t: [
if (simple.IsSimulationRunning())
( `1 m4 \3 v" L4 {1 q: P! Y WScript.Echo("Simulation is running!");
& B# l& M5 n6 E4 S, C ' K# q. {+ x. o. @
// Wait until simulation is finished % a: W) C( [9 T9 b4 x
while (!Finished) WScript.Sleep(2000);
% x) A9 r; {- Q. H+ w ) T6 M: k1 D! j% Y
simple.CloseModel(); $ _0 @% O- g8 B4 C2 t t
simple.Quit();
! m b* G4 {- p9 r5 `5 I+ OWScript.Quit();
: v- S$ F# E: {: a
1 w- W$ U* O: i5 x8 q \. L8 p
2 n: y, d; A* |2 S; N+ Nfunction RemoteControl_SimulationFinished()
3 k# q$ P6 p% ?' z) g: X* k. @{
( w( g |* N% l% I- ^/ {' W WScript.Echo("Simulation Finished!"); |