Example of a JScript
3 W6 s! L' {/ a& t! o+ wvar vbOKCancel = 1;
$ n) _1 Z6 j- H/ j7 z9 P. S+ Pvar vbCancel = 2;
, Q/ N! i P' U. Rvar vbInformation = 64;
! D& Z; D8 l" u8 o1 [' u6 k2 wvar Finished=false;
/ U2 P1 L% C# B( |) T: n5 [$ c# _* ~
( s( q$ |6 `5 H% O) |' d( Evar WSHShell = new ActiveXObject("WScript.Shell");
4 F- R5 t+ p/ v7 u) N7 i * b4 \8 D6 ?( a! \: u- g9 E! ~
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
0 C5 ?. p. q" }8 Y8 h' G- ]3 ] . @4 o. Q* F. E
simple.SetLicenseType("Runtime"); + ]9 G7 ?9 s, k8 J
9 j" ]8 L2 i& B/ ]
try
6 z7 Q( t$ V1 g9 V( p+ F% h{
: L' F7 \/ }0 J // Enter the path to a model file! 2 C9 |, @ f4 E* B4 B: E B7 Q
simple.LoadModel("C:\\Models\\Test.spp");
6 ^# l1 d. I: Q) u, ^: x}
; P8 H5 x2 [! S( E1 g1 K. wcatch (e) 2 d. a+ w+ V0 a8 j, t
{ 1 ]% ~6 \ G m$ n
WScript.Echo("Could not load Model!"); * J5 L R. i- q8 t9 e
WScript.Quit(); 2 K* D$ c$ Y# i. H
} # l m$ e, Z0 d) V- C o/ J
) e: W3 Y }% V2 r' m$ ]$ x) H
try # a7 F/ G% W- C# K& M
{
3 I" t' C" B# F9 w+ r3 q7 l+ A ] simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { : H- v+ d5 U1 d# M( F( B
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 0 B! r" H2 r+ S( M: d
if (r == vbCancel) 9 y# Y5 N! w1 Z/ _' K
{
% q4 r2 [3 \0 ]; w% C# O5 l3 c3 e simple.CloseModel();
+ G2 l! ]; C: A7 ] C `0 q9 ^ WScript.Quit();
0 A* `5 f! X% Q( N }
2 z8 U# Z, ~' P}
+ h1 S1 h% T& z8 |6 a
0 o$ U L% ^4 L/ [1 H, J1 h, B3 psimple.StartSimulation(".Models.Frame.EventController"); . i0 N/ p4 k! M
" o$ C- B6 Z* [8 g' O. E- i" qif (simple.IsSimulationRunning())
( ~# ?4 l3 h1 z+ T WScript.Echo("Simulation is running!"); ! f/ G" g) p, f" `* W2 q
- [/ I. o( O2 Z6 B& D. z N
// Wait until simulation is finished
# |1 u5 Y3 r6 s& h, }4 Vwhile (!Finished) WScript.Sleep(2000); 2 B$ }1 Q2 B D& l0 {& h
# S) H) J+ U. X, `& M1 Z0 T9 Y
simple.CloseModel(); 6 o; Q ?, X3 Q; ~4 j0 X% S
simple.Quit(); ; j4 l9 g# N& b5 K0 i, \4 k
WScript.Quit(); & x" S# h, l6 b9 ~2 }
" v1 e7 A4 b( F# `1 ~ 2 L3 z% U6 |5 o: C9 U
function RemoteControl_SimulationFinished() $ n* B, P% E, a \; J! H- d O
{
/ v0 N5 F' Y% x WScript.Echo("Simulation Finished!"); |