Example of a JScript
) s+ S; R7 G; _9 Avar vbOKCancel = 1; : d. F" E) P+ T$ ^) T
var vbCancel = 2;
/ W% i* @1 Q7 x% Wvar vbInformation = 64;
) b$ i4 H$ l( B0 B9 G( ~! |, Yvar Finished=false;
9 t" `9 E1 s0 ~: K* \( I + }4 e! n: E# V7 z) C% S4 }3 y& B
var WSHShell = new ActiveXObject("WScript.Shell");
& {" @3 l- u! w9 ]8 L3 L6 Y# s ; t/ H' X! T: i$ \' ]. f
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * D; r: i; P. \/ C# `9 K% p
9 Y u0 o$ r! F# msimple.SetLicenseType("Runtime"); , \6 d3 p/ y0 V- k$ M! s( |
2 g8 @" k+ ~2 S) e% d0 {8 Etry
# L# \2 `+ c5 D. k* x6 m- P{ " z$ g+ O: {& H2 J% }
// Enter the path to a model file! ( H' X) `- J: S) |6 M3 p- l8 w
simple.LoadModel("C:\\Models\\Test.spp"); % a$ J0 T( w; M7 b2 j
}
8 Q- V" {1 ?! D" B! v$ W/ Q0 E' icatch (e) 8 H' I/ @( Q3 H- X/ u: E, I J4 z
{
! u' C% ?' E; g8 {! f WScript.Echo("Could not load Model!"); 8 p5 i5 L" O8 X) T3 m+ `$ ~
WScript.Quit();
7 K; ]% h6 X- X& v( J8 ^/ D- z} . |) D: C3 D: W& f7 `" ]% @
* R& G3 {9 c; g1 U2 ^
try
, y! m9 y- j, q4 T{
7 j- j0 e! R- a7 m" p3 G5 u' F6 u simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 8 H" l7 Q6 N5 G4 e- w( n2 E: J6 X
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & r) O/ [2 k* v3 b$ a) W/ _
if (r == vbCancel)
0 }6 p: I! M" |% s6 Z {
( }/ R5 @: r1 j2 l+ a simple.CloseModel(); & |7 Z. X9 @9 m$ I. j: p; F" x
WScript.Quit(); 3 e$ L* c7 \( w3 F
} $ O6 r( g! [$ \- ~
} % A2 I- u2 Z% P y2 M0 _) X0 m% c$ }
7 f7 _4 c5 p( X
simple.StartSimulation(".Models.Frame.EventController");
" f' |2 t" t8 e: y) t v" y! P* r$ d3 c& }/ F0 m
if (simple.IsSimulationRunning())
/ c) o1 |2 a7 |! u0 H+ o WScript.Echo("Simulation is running!"); W9 M# w' {0 g0 r$ s
% f# W# H1 c- f( O2 v1 N
// Wait until simulation is finished
' d. g6 ^7 O( o' u) Iwhile (!Finished) WScript.Sleep(2000); - O0 t ]( J0 m( r* o7 C
8 u5 M9 w" I( {4 ~- u; Qsimple.CloseModel(); + B, q- w' Z' ^9 o# u2 f' r
simple.Quit(); 3 K4 h& e( w- P# L/ X0 {5 F7 Q, Y
WScript.Quit(); - I) u8 z P ], @4 z
% j- ]2 }: W2 f ) k& Q, A& Y5 L4 u/ `+ P
function RemoteControl_SimulationFinished() 7 B" f. m' E* d
{
* N2 G& A7 w: J+ T/ j9 D WScript.Echo("Simulation Finished!"); |