Example of a JScript |% J# r; n2 d+ u! J
var vbOKCancel = 1;
; Y- G- }4 f8 x5 hvar vbCancel = 2;
- Q' j- p; k# L; nvar vbInformation = 64;
: U2 Q" O2 M7 x: u+ B1 K* Hvar Finished=false; ! @4 t$ C; U8 {' P1 f" N4 O
, {" {9 L2 e7 v1 C% Z
var WSHShell = new ActiveXObject("WScript.Shell");
* g( t& S* I2 C# G
" ^8 s9 _ y* _# R: F! v/ F& m7 {var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
$ e% p) k- Z7 D5 v" j% u" {
, Q* _1 S1 {8 D/ L' @% |) Lsimple.SetLicenseType("Runtime");
, D( u& G, v+ G4 ^9 M! \; m
; i( C: T5 m8 g" x ktry
% \, U8 y. L' C( B8 [{ 5 ^3 e9 }$ o+ U/ O& C: |
// Enter the path to a model file!
1 C0 v1 I* @' Q simple.LoadModel("C:\\Models\\Test.spp");
7 a& D) C6 `/ r}
+ }" Y% t% f, }3 K2 ^& w+ t9 acatch (e)
9 n6 O( a; c% m{ 5 v* p- {( n0 A6 P5 q0 n$ E/ @
WScript.Echo("Could not load Model!");
+ Q$ t# [+ Y, R* H) a. _4 S6 H WScript.Quit();
" c' G1 ]! V' P5 f} # T+ K9 Z$ _; i
4 j/ k% F' G6 [
try 3 ]* l) G* ^- K9 {0 U- ?! C$ u4 _
{ 0 c. w) \' l, }3 ~& O
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
1 y( `/ q- t4 z( r# t; o# K r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
6 m- C; r- _3 } if (r == vbCancel) 3 y+ t- K; { G( D8 O' H
{ ! h: k8 ~* o( B) d7 g+ m+ w
simple.CloseModel();
) s% } M' Z, V WScript.Quit();
5 M# p) z( y" v6 C2 Z d+ J }
& L. C( a$ b0 ]& C+ R- U. L} * z+ e6 S8 K5 f$ M' T
8 U; ]7 M/ e+ G, i# |% b' bsimple.StartSimulation(".Models.Frame.EventController");
4 Q& y5 s! \& }. W8 n8 C) A0 | " l8 N# ]1 I* U9 C# H
if (simple.IsSimulationRunning()) . D7 k: P& o8 w& [+ Z* E1 ]7 x3 L O6 o
WScript.Echo("Simulation is running!"); 4 ^5 j& c: m8 y( P
8 i$ p7 p) o2 N// Wait until simulation is finished
* {1 f- l& i+ j* a) h* _$ \1 Ywhile (!Finished) WScript.Sleep(2000); 2 T$ h. z, P' g \2 S% s
1 c% E5 o/ Z+ _% f0 l; |- p
simple.CloseModel(); ! N1 U$ t2 n+ ]0 e d3 ]; x$ o9 P
simple.Quit(); * k$ V$ u3 C$ Q- v6 T' z' z
WScript.Quit();
2 L [- m: S+ i3 [- Q+ X) i2 ]
& Y/ _. Q' I& c# k/ ?, s9 o) |4 Q7 j) m 5 l. i, {. N0 R$ q. Y/ j
function RemoteControl_SimulationFinished()
. ~+ Z+ F3 H0 t R5 M3 S. g( ?{
/ t, L6 F1 g; G( k _ WScript.Echo("Simulation Finished!"); |