Example of a JScript
" p4 _; ~1 D, u- ~var vbOKCancel = 1; & {$ ~. E# o( v* P. \9 a% B
var vbCancel = 2; ! o" c$ u# H# l$ L
var vbInformation = 64; . V1 K3 Y, v9 Y2 g2 m; j# M6 p
var Finished=false;
4 S# y4 \4 [( j% P 6 F0 m" ]) m( G) R8 L6 K5 ]
var WSHShell = new ActiveXObject("WScript.Shell");
8 t* w0 C4 S1 ~; o
7 l! _9 ~' f9 w4 }7 wvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); : a. f$ Q+ v' e( T( k9 }2 J9 }
5 f: C# J3 k5 X% d3 k% Usimple.SetLicenseType("Runtime"); : m+ d+ u3 c9 z
; w1 Z0 d+ s8 t: b- I# `% J y5 F2 _1 Z$ |try
$ U R. I. c$ Z& h3 |0 Z* s{
& V7 F8 y0 w: c; x! b // Enter the path to a model file! " a9 ?; B4 f0 g; x C
simple.LoadModel("C:\\Models\\Test.spp"); ; n) b- w9 o4 b G1 F: l; T# B1 P" ~4 b
} 3 G; [6 u3 o3 ^2 A$ Q
catch (e) / Q6 Q5 }0 n; F
{
! I3 L' r$ a( m. v# z. b WScript.Echo("Could not load Model!");
4 V' l# H' |3 x- k0 ^; a WScript.Quit(); / I, w7 H+ ]; @: _$ k$ [8 P
}
9 }& x- F z* U" ~6 D 1 @7 J+ r5 Q4 U! y5 X! ~* U
try ' F6 |* d* B( r) D
{
: F* F3 f! Z6 c& I7 l% O simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ U- C k7 S5 m4 t, |( t9 y r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); % i! J# g$ ~9 l0 t0 e0 G1 R' T
if (r == vbCancel) C' d" d8 A) R/ c0 {, C7 C
{
3 a; n* m7 R, o4 S1 T* H; I simple.CloseModel(); + ]0 e! Y/ ~4 G4 T
WScript.Quit();
8 _! h. W, k/ H1 j3 \ } % m4 S1 S% C/ s8 P: y7 Z
}
4 b( v# T' q) v% Z# a1 f1 L$ `$ K
$ B) p( m7 K+ xsimple.StartSimulation(".Models.Frame.EventController");
& d7 D$ `. Y& [4 G ' T/ c5 y7 |! q* v
if (simple.IsSimulationRunning())
7 Y& Q& H/ b3 A' ~1 @ WScript.Echo("Simulation is running!"); + }* o; E6 ^) V5 a
U. d2 X* H( S0 ~
// Wait until simulation is finished
+ B3 [) U0 X' V; x7 j' n5 Swhile (!Finished) WScript.Sleep(2000);
) I. V3 @1 Y2 _/ I+ r2 q 4 j6 v# X, o" d8 t' J& b
simple.CloseModel();
$ ]6 g3 @7 e3 Csimple.Quit();
+ E( U# p3 i9 [# i LWScript.Quit(); # g* V$ ^! g2 y5 {& u0 A6 Z$ A& W3 k
& O+ A/ c W5 Q6 y% K2 Z
! O o0 e6 M. p1 ~# R- cfunction RemoteControl_SimulationFinished() # n Q; s9 k& w& x
{
) h( F" o5 H& E5 R9 l- E' e WScript.Echo("Simulation Finished!"); |