Example of a JScript
8 @6 i0 f: g+ Rvar vbOKCancel = 1; + |, E5 k' U# O0 [! S C1 |9 J
var vbCancel = 2;
9 P4 t W; a/ `4 Y4 bvar vbInformation = 64; p) h, D0 A0 R2 Y: C) u( s) i
var Finished=false;
: @; @: j& b( m- ~0 A1 f 7 ?- [/ X. k9 |2 ]
var WSHShell = new ActiveXObject("WScript.Shell"); 0 e; K' i( o( a( _; c9 E- W
6 I" ]; S% H0 m" F4 W* s
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ; S& G, y9 i8 A, [- [* E
, P- O" j- _8 A" t
simple.SetLicenseType("Runtime"); * p" Y. _2 m0 l
5 @2 q+ V6 J6 [/ E' A" _
try
1 e8 Y8 b$ } Q7 t/ G/ ~+ H. K{
1 P# t8 {( l) f, i z // Enter the path to a model file! + h" ~: s9 N; S0 ]
simple.LoadModel("C:\\Models\\Test.spp");
$ M3 g9 c% V8 q8 P. K& \}
% }+ r1 C$ O) e) Z+ V8 d1 v! ncatch (e) 6 {5 l: s8 o" F& E' X2 D
{
- X2 f7 X2 n- N/ `( N a& ^( D WScript.Echo("Could not load Model!"); 6 @ D% D d; H' D' ^. v3 l( K: g
WScript.Quit();
; O* p5 x& q' I! H F1 `} 7 l6 Z; w- O! m2 C5 A( \0 `
. @6 l, y3 E3 _- @% Z& B9 ?# jtry
& W$ \: G" [- {; s% A{
, a" ~' {; i8 V simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
* c& e4 {7 ~# c) F r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); j& p( U# H- n# n! s3 p1 `5 ^
if (r == vbCancel)
* k! \8 n3 c+ Y { ) T, @1 l- m; e, v" i7 {* t
simple.CloseModel(); P2 d: H( s' ]4 y" v9 I2 M, _
WScript.Quit(); 7 Z; Q4 D; X3 r, Q0 y. y
}
0 S; k* }* x5 t% d1 M# M} & n8 v, V* l5 B5 G2 s
1 O/ R# S: u" [ ssimple.StartSimulation(".Models.Frame.EventController"); & G9 i8 N8 O4 H9 g
8 I+ M0 x2 X L/ g( [6 Cif (simple.IsSimulationRunning()) ) W/ H- m, @% g/ Z2 p& T3 u# ]
WScript.Echo("Simulation is running!"); / ?" ?4 `% D5 S" n7 [, D. m9 x |
6 g& G- A# d+ r1 w/ [4 R6 x
// Wait until simulation is finished
9 \! i; c3 ~2 ]9 l8 {while (!Finished) WScript.Sleep(2000);
" ?1 q* e; v% w8 x8 i m1 Q
* U2 ^$ c8 J usimple.CloseModel();
7 A* {4 g7 z! V$ Ysimple.Quit();
9 t6 r4 w" M" \( r( T3 a( oWScript.Quit();
: H! Z' H' [. {0 }% t2 E # g8 l5 _) H. R+ P- n
# y9 v5 O) e1 |6 H; I( s! W
function RemoteControl_SimulationFinished()
2 s: \# `8 ?: U* p: e{
( s" U+ ^- W" p- L( \6 a! R WScript.Echo("Simulation Finished!"); |