Example of a JScript : ~- K, U$ |0 O+ h
var vbOKCancel = 1; $ w8 x$ V& o7 l7 o6 N! g$ `+ c2 Z
var vbCancel = 2; : Z3 J- Q; p9 X: J# @- Z
var vbInformation = 64; : o+ R0 h, c/ `1 n- ^& ~
var Finished=false;
+ i6 S; V1 L$ x" |7 c+ W 2 U3 I4 ~( Y' ?: c) |
var WSHShell = new ActiveXObject("WScript.Shell"); - l$ i" |% _# q9 I
1 z: J: b3 ~4 e" Q2 Z. ^
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; `9 T; @& k6 s Y* Z4 K 9 f+ F7 Y' l: d! [( V
simple.SetLicenseType("Runtime"); 0 \: `3 t0 r% U+ m
1 y! Q" }( ]0 Y! E3 a$ ^try 4 M# [; \) x x# V
{ & E5 b: ]; \& J
// Enter the path to a model file! 1 ]6 p9 f2 c+ M G! t
simple.LoadModel("C:\\Models\\Test.spp");
n& u+ z! T1 v" q; _! I5 x7 }}
3 t2 m9 l) z, v/ v! [+ h2 n1 A9 Ccatch (e)
2 H/ ?* }3 q6 [- D{
7 f; L! x( a* ` |2 h2 P' s3 c+ r WScript.Echo("Could not load Model!");
6 |; l. a+ |! T$ X WScript.Quit(); 1 Y& E' {3 f2 ]- l9 ?6 h
} 8 M* F5 v5 Y8 _/ J6 J
2 X$ W1 @$ Z3 `try $ m( R% ?, H* S" z
{
* G# s9 `" ]. i8 q simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { % g! a% A/ e8 v, X9 j
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); " F( l3 T, X/ y- J
if (r == vbCancel) ) p2 o6 {' `" r1 U; N
{ 5 d. x: R/ c% f/ K& {6 K1 \; v7 }
simple.CloseModel();
, J5 P2 J4 j! Y1 ]3 m WScript.Quit();
( f- ^8 Y! J3 K$ W" x& a) V) _ } 8 A; k" N( u% ]; e) D6 z
}
! t0 x0 j; C' E+ M) S4 E 6 X. Y0 P$ h9 V- F! A7 f- E
simple.StartSimulation(".Models.Frame.EventController"); - s" S/ y2 g& u: ?+ G# k
: f$ X. m' @9 A
if (simple.IsSimulationRunning()) + X7 I( e- D) s) x% y, R; s
WScript.Echo("Simulation is running!");
# z% p) z4 F$ P5 I & }' a( Q7 f, X! a. E% C
// Wait until simulation is finished
' Y. o' N# A9 t, F1 Q2 j# Gwhile (!Finished) WScript.Sleep(2000);
d, `+ l* L$ ~% M* k. o, c ( f/ C# u1 P% s; g7 V
simple.CloseModel();
; }) [ V& Y- ^/ L$ M& Esimple.Quit(); , ]& g5 M' q. {$ v" E( h! \% A5 b% L
WScript.Quit(); - V' L" L4 v! Q2 l
5 C0 H1 X. ]* I X5 v ! h+ V, y/ {5 r3 _1 c4 p
function RemoteControl_SimulationFinished()
; r( j! ]+ }9 r3 u1 U0 d{
1 [& d3 g- k u6 |/ I; m9 Z WScript.Echo("Simulation Finished!"); |