Example of a JScript
! `6 i _" F9 `var vbOKCancel = 1; ' R( Y N& ^* Z R3 l
var vbCancel = 2;
; K) ~2 \- q6 J: Svar vbInformation = 64; ; g! A$ N z9 ?& o- f
var Finished=false; 2 `; h, S! ~. T/ ?' N, _# H
5 K- i8 Z; ?4 v& _7 [
var WSHShell = new ActiveXObject("WScript.Shell"); + i: n$ u/ w8 _& O6 a1 v- m
! h; b6 Z% G$ f0 H* w, G) t; z. W4 gvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ! W% ^% |; J. h# ^7 E& s
- T" E7 z9 s- X: K
simple.SetLicenseType("Runtime");
" _9 p) G& Y9 W2 t: V% A0 O+ u
6 O+ F" R1 U: D5 Z! R) b, @try - ^* u* J8 g4 [1 a( [. \* O4 |/ a
{ ; s! L P _+ z
// Enter the path to a model file! - X+ p+ S9 W6 s {0 s+ _. L
simple.LoadModel("C:\\Models\\Test.spp");
& e ?) b7 X, ?3 {2 m$ w} 5 f& x" {( o8 H) j
catch (e) ) X, F# }; E3 C) d2 Q% E: h5 }) Q
{
( L1 {8 B/ P& v: B9 [ x: P WScript.Echo("Could not load Model!");
. u; O# L4 }+ p- I WScript.Quit(); * A1 p) X" J. S; Z( q" E5 V6 _
}
/ a" E/ p% J8 s$ \, Q " O; U) c, f' Y1 d0 A9 e4 M+ C
try 7 a3 ^* l6 q$ x' {9 u
{
8 Q$ |. [2 i8 ~ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 7 s% m5 q; t2 {
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 1 N/ a' I2 r3 N0 M
if (r == vbCancel)
5 l! o* ~* ^# R- \' o+ W { ) F# h; C, g4 F9 p
simple.CloseModel(); + A$ k: S2 n0 Q9 E3 H# {
WScript.Quit();
+ K8 \$ q. [+ ~' R9 @5 Q: ? }
' Y- L2 M' L3 t. c, w' ~" c} + ?) P3 D ]" K% O6 c* L0 c
e. @ q$ X+ i6 y' Y) `. j* r# Lsimple.StartSimulation(".Models.Frame.EventController");
P! b s, U V8 \& g / y2 e! k) U* E# d' K) ^
if (simple.IsSimulationRunning())
3 K/ j# N6 O- h; X+ M, T4 _$ P WScript.Echo("Simulation is running!"); 0 k9 b& F" g: @4 z" Z4 O2 R
; n3 e. @/ J6 } K+ K$ q3 G( N
// Wait until simulation is finished
6 H. j q; t4 j' ^& L' Bwhile (!Finished) WScript.Sleep(2000); - d# d u) ^% S( w
5 C4 J5 M5 e0 A( Q' Lsimple.CloseModel();
" j! F& E8 t- g# I8 c0 @simple.Quit();
# U7 j% w: w0 d3 ^/ ]WScript.Quit();
4 x& A5 W% v, X; D
5 C# R \( h; q J2 @3 A* e
% {( `* } N) Z/ v1 a( t5 Y, l, bfunction RemoteControl_SimulationFinished() ! ?- y% a" c7 @- F8 ~2 g3 S
{ 7 _ @2 E0 x3 j, _
WScript.Echo("Simulation Finished!"); |