Example of a JScript
" o' R/ e, d/ u& B# Tvar vbOKCancel = 1;
2 z* m/ h" _# {1 C- Xvar vbCancel = 2; f' F3 F/ o5 c+ Y
var vbInformation = 64;
5 g; b1 k& r6 T% O% Gvar Finished=false;
" H, J7 p: \: n
4 K# [& {# S1 T- @) d1 w2 H: dvar WSHShell = new ActiveXObject("WScript.Shell");
9 {3 e& q+ C4 }+ b+ d0 g8 S, H / }% V" V2 \) q, P8 h4 s1 d
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 1 g; }$ Q# U6 Q) \2 n3 p$ e* b
2 Y+ V$ ]3 ]; D8 }3 B& O3 H2 b# Z, a
simple.SetLicenseType("Runtime");
" s$ c( a: @6 e/ m% z; }& v2 V
/ v8 I9 a- R% c% s3 I# Vtry / X: o5 \) n+ R0 V& i, y& S b
{
# U' X, _9 R* u% a! I // Enter the path to a model file!
6 W r8 d' v( }: r) O2 M4 c; m simple.LoadModel("C:\\Models\\Test.spp");
% o: \# L6 I. s* U* j% z}
9 V' `$ c; E s, }! ocatch (e)
$ J* c! a7 ?6 E4 ~& l{ ; G$ q+ K" }+ P" @
WScript.Echo("Could not load Model!"); 2 g' w: u; Z* m* k Y
WScript.Quit();
6 e' T9 J' W* E. J} ( |( b# w, `% u& I4 n: Z C
2 ]! C! G% a7 }2 _
try - Z3 m) g& w% {0 v |
{ 0 Q& s3 A/ z8 m3 n
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
( s1 {$ e% W3 t- a1 S0 c r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
9 J9 [5 J' ~- ? if (r == vbCancel)
4 ~* s) M9 k# N l& ? I { $ V! X6 J: m" A
simple.CloseModel();
% n; _: l8 Q6 ~+ ?0 h WScript.Quit();
7 a3 V( e0 F. k$ B) E }
6 [9 ]& ^6 p( S: Z/ ]; q} 4 }& ]/ {5 J) \
5 F$ m1 B) U9 z! C) Xsimple.StartSimulation(".Models.Frame.EventController");
, @6 ] b# I& H: R
0 e, f2 |4 `% e! J; kif (simple.IsSimulationRunning()) . Y' @3 q4 b0 E4 Y
WScript.Echo("Simulation is running!");
! U# B5 ]. M7 R# l) }
9 [0 i2 v. \2 {$ D+ v& F" x* M% A1 P* r// Wait until simulation is finished
% G) d3 u( Q% Awhile (!Finished) WScript.Sleep(2000); + V' u8 k7 @4 c( t! H% A
]* g' O' J# ~7 K) |% `$ \/ N
simple.CloseModel(); # B6 @- w) m- o5 E
simple.Quit();
5 V7 Z' r& x; _& t8 c7 {# LWScript.Quit();
. V0 M+ g* o! X $ y" l% T6 F" V/ N, ?! O2 O3 g
. x$ ]7 b! N7 i p3 g/ Lfunction RemoteControl_SimulationFinished() ' `2 c) S( @4 o' k: B
{
+ g: h5 m' x$ \2 P WScript.Echo("Simulation Finished!"); |