Example of a JScript ! Y. [. `. B& q% H# R
var vbOKCancel = 1; p! ]# Y3 C) x% V" X
var vbCancel = 2; ) s; N8 E" |+ t8 Y3 {& \, S
var vbInformation = 64;
! W% I: \" z% c* \var Finished=false; $ L( b' F! j p0 i
# [0 G2 U7 \: A
var WSHShell = new ActiveXObject("WScript.Shell"); ?! J( F# u* ^$ L \, o. f
5 z5 e& D# ]) m' p, D8 bvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); - a! z' W6 @* \0 q, {/ a
) G! s/ W5 m6 I3 @* a( U+ `! \simple.SetLicenseType("Runtime"); 2 e( W- |7 O7 k( m! \
; A- U5 y5 r& U1 ~0 x0 n5 }try 6 I6 a" C1 g W5 O9 K _6 E
{
: Z" v1 f+ U; j j: ~) Q // Enter the path to a model file! 5 W' h q: ?2 P9 l6 U/ [
simple.LoadModel("C:\\Models\\Test.spp"); % a2 q. C2 O" i. F7 a' N5 I. s
}
U/ Z/ _* N8 _catch (e) ]4 r+ Z X$ V1 `
{
6 W8 G0 M" P/ H5 m0 H WScript.Echo("Could not load Model!");
+ x+ R2 S" C6 i: _2 J6 y0 i WScript.Quit(); . W- |- J# x. O: q. i- [1 [
} ) T8 `- y! Z$ q, F _/ z8 F
8 S/ Y2 r: j! t
try ! t- L9 D3 Z7 z
{ : g5 J) c7 T/ m4 n
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
1 U* _ `0 C r2 T3 F7 [" [ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); " ]8 `# @" X) T: K* o
if (r == vbCancel) - x4 X0 M5 l+ S+ O: }& \) M
{
$ q& d0 `1 _- `* H$ W simple.CloseModel();
6 R2 W( ~5 n* v6 Z1 f" t WScript.Quit(); $ m4 l4 v) `4 c6 F5 c; X
} " ~2 I) R& ^2 Z* u: Q0 V7 B2 G
}
, u, u. B9 o2 c- S; U/ I
K5 O+ `9 p; ^) _simple.StartSimulation(".Models.Frame.EventController"); 8 H/ o5 |) d* C
" k t5 l; Z$ a) b' ~2 L
if (simple.IsSimulationRunning()) . x d2 Y1 |/ P5 ?
WScript.Echo("Simulation is running!"); 5 g3 J4 @* ]' H& V( ?9 J
0 A1 _6 Z; C; j: o4 t9 Z// Wait until simulation is finished
& C V( O* r8 Twhile (!Finished) WScript.Sleep(2000); % A P, @! @3 N: W) [
) }* g. H* d$ X# E" G) B7 ?$ f
simple.CloseModel();
( T; Y9 D4 A9 @; Csimple.Quit();
; _, k1 r' C/ g" J( G7 CWScript.Quit(); 8 ]: L3 {+ \; v8 Z: Y
+ C+ {7 z A, ]# A- ]' u9 v
+ I, U* Y) {# M: ^9 U, `9 U' g
function RemoteControl_SimulationFinished()
H' C3 F, Y5 v{
5 O, o2 T* M* I WScript.Echo("Simulation Finished!"); |