Example of a JScript
! {- b3 r& o% k* \var vbOKCancel = 1;
% O9 p9 U F h- hvar vbCancel = 2;
9 |+ ?8 U, ?9 m/ Evar vbInformation = 64;
& R* A, D. G& {( X% v* a2 avar Finished=false; 6 ^' k7 l) U% K! f& _, w3 P
9 w1 x$ L- G1 [# ?, C
var WSHShell = new ActiveXObject("WScript.Shell");
* g! A, g) \- ]$ ^% V0 D2 I3 F! \3 [
- d) ~( l5 R/ H. g. |7 i( zvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
, Z: L1 y- n; z5 {7 A
3 }5 e c- }. N6 M! Isimple.SetLicenseType("Runtime"); & j: C% `, `/ P$ h7 v; r" `
' ?6 Z- r5 S8 b/ @0 Atry ! @: k2 [. h* h- E; @
{
+ H4 i2 U6 w$ Y // Enter the path to a model file!
" M1 r* d7 O: E+ } simple.LoadModel("C:\\Models\\Test.spp");
5 G- F& b3 P) m}
7 ~( M3 h4 l" d) O; U9 O$ T4 j, rcatch (e)
. |! n8 N0 c3 H Z& D1 o& U{ 5 J+ B! `5 w5 o/ k m! l! b
WScript.Echo("Could not load Model!");
# {0 _- i6 y7 M5 J* f( n h2 v WScript.Quit();
3 X% p$ l, Y# s- z. e2 Z. `/ T) E}
& V0 P A5 z3 B/ ?
! F g0 m$ c+ X( d9 A6 b9 dtry
& }* r' r+ E9 G4 U9 U# U6 K% _{ , M2 L( n: k8 @1 y s
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ) Q, F* H* c5 u
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ( A- ~ L( D# ^1 q
if (r == vbCancel)
6 y/ s5 H- V8 W! K4 p {
- P+ d# v8 K4 n7 ?! V simple.CloseModel(); " I; G7 {% `; E" S2 u% w& s6 H
WScript.Quit();
$ o. m0 j( N6 T0 H- ^2 D } # z& U) B9 h+ _" N u8 N' }- d
}
1 y! C+ i3 Z% i0 U& Y / C6 p* B' @2 H7 W
simple.StartSimulation(".Models.Frame.EventController");
2 r$ e; _5 C' t" S+ s; z! M
: @+ a; Y% _ T. i' s0 S5 |if (simple.IsSimulationRunning())
: B( t0 L4 r5 c' i" ?+ a WScript.Echo("Simulation is running!"); 6 K+ M$ l* {1 w5 X; e
! ?( Z- d3 t1 F% F$ M3 G// Wait until simulation is finished
' ]8 B/ b! q/ T8 T G8 h% U, d1 fwhile (!Finished) WScript.Sleep(2000);
! `% g5 U; C: M1 }- x ! d1 `) `3 |, v' F' C l& W
simple.CloseModel(); " m# J, a) g5 J, I! X1 j* {
simple.Quit();
: G+ K& _3 b: ?$ K" uWScript.Quit(); z1 H/ G" K$ d
n) |5 P: p0 |! K5 N% ]
# D; }% m( K* [9 J9 }function RemoteControl_SimulationFinished() $ l! g- z' X. x" W* C
{ 4 Y9 W; i, f* h$ W
WScript.Echo("Simulation Finished!"); |