Example of a JScript : |2 J! g+ c; D8 Y( u0 I
var vbOKCancel = 1; , D# r* i; l* G( {) B* C% a
var vbCancel = 2; / v$ u. B! _' g* `2 h
var vbInformation = 64; 8 o$ u2 U7 j5 r( `
var Finished=false;
: s2 `' S( {2 `3 R3 I ( B# g- ]1 [# S
var WSHShell = new ActiveXObject("WScript.Shell"); a5 V2 R& B5 L5 n/ q
- i9 E( y/ b. P' B ovar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
( z. r5 L: |7 @" j
; p: ^' v. T' a, z! x7 z( `% Csimple.SetLicenseType("Runtime"); & k q5 p8 U, C8 ^, ? p
- R3 g5 ]: P/ v4 }- b& Y
try 2 m/ L F- I1 E/ V1 s" O. a
{
; C* F4 O$ e- J+ W; O: Q' n // Enter the path to a model file! $ t$ \ ~1 ~, Z# Z
simple.LoadModel("C:\\Models\\Test.spp");
4 P3 c3 H5 S u b8 n} # w( Y2 q; B0 f/ B7 j# ~
catch (e)
; Z: k2 G, ^. c: j9 R& l! Z{
* t8 }, `: M- n2 b; {. x. N3 } WScript.Echo("Could not load Model!");
! ~3 A8 i2 \ [; d$ { WScript.Quit(); H3 A, G L0 V' R
}
2 k% u, i I \4 T/ J
. P( v4 |. e) }" C! g N2 k1 Rtry ) S+ }: w: |( G* v0 p( g+ G
{ $ X/ d' @+ E. d9 ]: K
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
. T5 n# ?6 \2 w8 f+ A r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); # A+ h5 M. G/ K2 t6 X4 ?0 _9 X
if (r == vbCancel) - \4 `9 ]$ H- b* o
{ O3 V( D. J8 A- V1 w! e
simple.CloseModel(); 8 ~3 l# y: r2 u3 c
WScript.Quit();
( T2 }5 }9 k" Z, u& a8 ?! X }
9 G+ ]8 N) n+ K4 [8 V, H2 [" a}
9 }9 R6 Y" h. I: Y& M/ z3 e D0 Z ! F5 H) _0 z& U
simple.StartSimulation(".Models.Frame.EventController");
0 b8 }0 p& M7 b( \ * D- o+ }* @7 U2 F% w/ G
if (simple.IsSimulationRunning())
9 C0 ^( M" X8 j- y% z WScript.Echo("Simulation is running!");
3 j5 j! C' g# F/ Y/ R: u8 j
- @% D( U7 i+ r// Wait until simulation is finished
* M: q9 \- A- t$ ]" ~while (!Finished) WScript.Sleep(2000); # N# |6 C; ]9 b3 g
# x5 d, L. I; G1 q Y3 D) R
simple.CloseModel();
1 W* o$ W/ e/ }9 w# ?simple.Quit();
4 R: V2 z: S2 C) n! W- ?WScript.Quit();
; y0 |, H6 h1 o ' _0 g/ ^0 `) g' k; Q: _/ f
/ D$ w0 m C6 o0 ]
function RemoteControl_SimulationFinished() % \, e# }0 C" ~: W0 y( p0 k& p
{ 0 j% S2 `* K& i& Y }
WScript.Echo("Simulation Finished!"); |