Example of a JScript $ h% J6 C# u# w; h
var vbOKCancel = 1;
0 q( z b8 C6 \1 ?8 ^# qvar vbCancel = 2; & o* {' s2 L8 X8 ] ]$ _
var vbInformation = 64;
- P7 E# p: ` Z6 p9 @var Finished=false; * m: X. a1 d0 O. v0 t. _
3 \7 P! `/ s1 c2 J2 L0 | p
var WSHShell = new ActiveXObject("WScript.Shell"); / Q. Y5 L5 a$ G( _& }/ s
/ F+ S0 N# O+ cvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
3 k' `, y& l: H/ K- u
; G5 B7 f7 \3 u: hsimple.SetLicenseType("Runtime");
: [/ I0 t ` Q% W7 x
: B6 \/ _$ @) t$ vtry 5 p4 L, v, ~# `
{ : p4 F0 G9 R. g0 ]+ T: m1 {
// Enter the path to a model file! ' }; }4 M! i# r( q% D0 B% m$ u$ K, B
simple.LoadModel("C:\\Models\\Test.spp");
% G" t9 b$ M; J6 F$ q$ o} ' @" |0 m& f' `
catch (e) / _) ~: u$ P1 l9 d/ E4 m
{ 5 p, w+ J; ]) Z
WScript.Echo("Could not load Model!"); ) k$ M+ X, V1 i+ t! c! _+ R+ Q
WScript.Quit(); $ L$ @# p$ Z) L2 P r3 F
}
7 V/ g u; p; ?5 A3 T* z
" r* `" Y, d( o! _try
; g% B! ~5 x3 D5 G3 o) A8 Z1 ?{
% `, a# T% c+ D; o( @ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ; x+ v$ ~( V7 n! h2 l; |
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ) D8 o# ~5 }7 ]. {& j. N. V
if (r == vbCancel) / l- K$ C+ ~# M" h% ^: H9 f
{ & O0 s* g3 R' r* i# D
simple.CloseModel(); 6 s' ]! E# N# _5 I4 q4 p) S9 m" B6 @
WScript.Quit();
0 q, b! K( k V( q$ L }
; l* A0 b# j8 P3 P}
; Y/ u$ J6 t) G7 k' h; ~6 U3 Y 2 o! o/ t4 S* W) i
simple.StartSimulation(".Models.Frame.EventController"); - T' V+ y- J6 y
# W0 f4 b& y9 M
if (simple.IsSimulationRunning()) , q; h# n/ \3 t
WScript.Echo("Simulation is running!");
6 P$ M2 i+ t, B% d+ \. E0 e2 E U6 Q
! J" a+ u; \5 k6 \9 Z0 |// Wait until simulation is finished & b: t, g! V' N
while (!Finished) WScript.Sleep(2000);
8 x# E* c ~8 F- e
) r. r" D; j- l7 L+ Fsimple.CloseModel();
- l- z* ]7 A" Y! ksimple.Quit();
5 m% O9 a7 O! w/ h$ ?WScript.Quit(); + `, F! W" F7 \, f
: R$ ]6 h" x; y" a- [
3 U3 p% ^0 ]# i+ m$ u9 Q$ X$ g: H
function RemoteControl_SimulationFinished() ( O. J7 @0 e! G5 f4 e
{ % X7 H B% W0 y) o; `; x$ f
WScript.Echo("Simulation Finished!"); |