Example of a JScript
$ R$ {. D4 ]% }var vbOKCancel = 1;
$ h+ t0 A* A3 `4 I+ C; i6 }* cvar vbCancel = 2;
3 N) K! m9 y @9 F$ `var vbInformation = 64; 3 Y+ A3 F8 i8 s2 M+ [* I' N2 H
var Finished=false; ' d2 @) n: P ^$ o$ F. d
& _! F2 q4 X! R9 ^& ?. o- ]var WSHShell = new ActiveXObject("WScript.Shell");
( b1 |$ T/ ^" F( Z; V0 `
c' t8 [8 u# o1 d: b7 lvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 1 Y3 z4 x E3 x
3 S0 c4 \$ _8 O! p8 s
simple.SetLicenseType("Runtime"); ' M. p2 ?4 D9 u ?) M, N8 J
- [, T7 A( S! _: h
try
: B( |' O) K+ c |* A' J{ $ M, E' Q% ]* F# c# c$ _
// Enter the path to a model file!
: \2 r5 Q, S$ K G+ J% T U! B, a simple.LoadModel("C:\\Models\\Test.spp");
5 g! M6 Z: Y3 U7 w! ^} - U _) L# H5 ~4 E( x) Y
catch (e) N; W. u- a+ ~; F, S, g/ J8 O
{ \6 d3 h' d, x( P+ m1 m
WScript.Echo("Could not load Model!"); 7 n: @4 y$ \' \& j& ?" g
WScript.Quit();
1 t( X* X: T+ T( k0 r}
; v! U0 m# M5 g/ }( s2 ], _ & j8 X/ }9 D7 {! O
try
: P) D% W0 \' A4 }/ c& M{
, T& E1 u; n- _7 `# d simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
- s4 c t: h3 }9 M r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
" Q/ o' t# K7 Y9 \1 a1 m if (r == vbCancel) ' x" b4 o0 P& u3 B8 r
{
& y8 b! l0 o. V: f: V, V& \ simple.CloseModel();
& v& s3 x0 B0 a& D4 M+ |" ]; Q( K( x# k WScript.Quit();
$ }0 `- s/ x6 o, E1 @ }
5 t; k: u5 @5 A) f& x& _& R} ' {0 n( `0 h: n( F
4 N# [/ I/ D0 C/ f* C
simple.StartSimulation(".Models.Frame.EventController"); & @5 A& M$ Y0 t
+ O9 P' j( y$ G1 s7 S8 R: Z
if (simple.IsSimulationRunning())
6 U* l2 }/ S0 {" Y6 l WScript.Echo("Simulation is running!"); # ]5 o" I$ X, b4 s
* e1 e3 i& y0 Q' A/ N0 S$ W
// Wait until simulation is finished
4 G! Z7 N7 x" c; J) R+ F9 Jwhile (!Finished) WScript.Sleep(2000);
$ q3 m# T% \' i' z! X, l3 x7 x / s" ~9 }* d; |( J4 x" J- G* L
simple.CloseModel();
6 ]$ z6 L% q0 d. H8 r" u& N8 _simple.Quit(); " F7 @/ S& V, D0 q4 _. i3 f0 l
WScript.Quit();
. l' E; ^* I+ { ( q5 m6 [2 H8 H" D
3 m5 O7 c0 B# E G# Hfunction RemoteControl_SimulationFinished()
2 Y* n# z3 r- h+ i, `+ K{ 5 P( V, a6 E. Z* M: _# [% Z/ O
WScript.Echo("Simulation Finished!"); |