Example of a JScript . c( |" I1 D. ^$ M6 q: U! e
var vbOKCancel = 1; 7 K; W k' W, J/ V3 S9 M
var vbCancel = 2; ; B7 \% ]" T: `6 q9 b/ ?
var vbInformation = 64; % p! n8 w5 w k/ _
var Finished=false; ' W* P! k, E" P9 U5 m! J6 c1 ^
/ E3 h3 K# x \! F; L4 j
var WSHShell = new ActiveXObject("WScript.Shell");
: X# A$ H& u! e; Z3 Z/ b % T, J) R9 W; T( c2 D% {
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); - R; M7 ?4 @9 B
4 O3 Z; G6 O+ p0 V; E U0 m. P! q4 {
simple.SetLicenseType("Runtime");
! `$ w5 n0 [4 G- q0 S" b
5 J( A. u. W+ X- P+ ?1 r) m. wtry
6 X7 r8 }# `: D9 u3 P. n{ ; P' l! _5 O" ]) X! U
// Enter the path to a model file! " z! V' s- E0 z6 H
simple.LoadModel("C:\\Models\\Test.spp"); " N! v$ R) ^: [
}
7 r& }& x/ h: D0 z9 Hcatch (e) , i4 N, L$ I( l, _ a& `% ~( g% X
{
+ I+ k9 I* _3 W( w# M5 t! A8 L WScript.Echo("Could not load Model!"); 4 u$ Y" s" T1 ]; r
WScript.Quit();
7 }' q. D: p. Z}
. }% n3 v* H2 _ |4 g& a 5 \! g1 J$ s' l. W! w
try
& D9 W9 ^2 f2 t{
/ C2 p. U+ q$ T7 I2 y3 } simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 6 L* i2 m$ ~9 V5 ]3 O8 y
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 4 f( c& ?1 m0 K1 Q) c8 ^6 Z
if (r == vbCancel)
, V9 E5 c4 Y* z1 g# U" X { ! a# w8 f9 t2 `8 P6 [
simple.CloseModel(); ; M0 w8 N# T6 A: K# p/ N Q
WScript.Quit();
, O* F7 X. m0 _* G } 8 A% H B& @+ m# [0 B1 h
} : u$ T+ n; h4 H* B% P
6 [! w) |8 e/ x# j% U
simple.StartSimulation(".Models.Frame.EventController"); 8 t9 M7 J) T( E2 {
# w& _) Y) V1 \" G( P' [! }! R
if (simple.IsSimulationRunning()) & u0 J% E$ s" ?3 q9 j
WScript.Echo("Simulation is running!");
: V/ L; s: s }5 O }) N " T! n+ j+ X( u0 Z" t
// Wait until simulation is finished
( f8 L; _. t$ k- W, b1 u2 J' qwhile (!Finished) WScript.Sleep(2000);
- M Q! }5 j6 Z * R2 L' B3 G, z' q% O
simple.CloseModel();
$ |4 G6 e4 E, a/ }7 V9 t) `simple.Quit();
3 i# o b6 f$ _' iWScript.Quit(); 9 t" v, J& w6 C B3 `0 [! i. ?
& t+ y% }9 U; S( U F! a ; I% J8 B3 G; T' @
function RemoteControl_SimulationFinished() * ]7 l/ \8 E) C; O: u' l
{ 7 U9 M* W( e+ Y7 ]# K( o1 X
WScript.Echo("Simulation Finished!"); |