Example of a JScript
+ e& _4 w9 i- [# [; d) W7 ^var vbOKCancel = 1;
7 I) ^6 U; H( M* n! z9 s% B5 evar vbCancel = 2;
( @1 y9 U" {' evar vbInformation = 64;
! X0 Q* U) F( q7 _/ Mvar Finished=false;
* F% W2 ~) b6 i* n# j! T " D9 J) ?' |2 y% `& V% o
var WSHShell = new ActiveXObject("WScript.Shell"); $ }: d8 B8 h+ u* F+ t
( F L1 X1 [% G" U: S5 o& ~
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
, E8 X6 o, F, } # o* u+ ^0 m# n3 W) D2 | w
simple.SetLicenseType("Runtime");
% k9 n* c9 f t
+ x% R5 {3 g. m3 k T% L6 utry ! `& W6 I4 F/ |
{
" o+ ]: q4 Y5 ]9 ]9 s h2 M0 a0 @ // Enter the path to a model file!
; _# f. I F* K6 M4 {1 P simple.LoadModel("C:\\Models\\Test.spp");
* Y/ V' T+ _0 f9 f$ Y$ ]}
, }+ z& l x/ s9 H$ d' D5 _4 Fcatch (e) $ O5 [ L9 S3 i! G6 z
{
& b) {7 M& L% Y9 T5 o# }1 H WScript.Echo("Could not load Model!"); , C. q B/ r7 ~- T
WScript.Quit(); 0 U' z# \, N. N- _5 T: T
}
3 g+ S" C3 ? R& z9 j' X5 {, s2 Z
5 i5 p( X/ c: @- b! _2 }6 k7 ktry 8 h& P! U! }& n: O( |+ [; g0 p" t
{ 6 v3 W& F, [! w T+ V1 T
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { + X! L$ {/ r: R: B1 J9 s) r
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
* }& R, b3 b& q) O* E if (r == vbCancel)
4 K P+ \' f* E: v+ `8 M, {' u$ m { b$ J; _ P8 N; D6 ~7 t) R" \
simple.CloseModel();
6 e! j3 T5 j% ?( t- i' v. U WScript.Quit();
n' r8 A( H" U' i) Q5 i }
9 F L( Q* C: i7 r/ p5 U1 M}
& F0 V2 H- g' v) }2 p 0 T8 U8 L3 r& }4 l- A
simple.StartSimulation(".Models.Frame.EventController"); , b7 {6 u& r& j' {
- f1 O; V K+ J, T7 a6 T1 Zif (simple.IsSimulationRunning()) & X* `- v& r4 ^! ^
WScript.Echo("Simulation is running!"); 5 L/ ]) a; c/ q$ C$ O: o/ t" L T
3 Q2 P6 v6 `2 p: v5 e7 N% H5 s// Wait until simulation is finished
! P" b0 W) u$ a& o8 w, a( h* Iwhile (!Finished) WScript.Sleep(2000);
7 L* T. Z5 ~& b 1 U+ }% Q9 h) D2 z& I
simple.CloseModel(); - G8 f( [3 ?4 I, f1 ?+ t
simple.Quit(); ) z1 _, m( H7 \, d* Y0 P: M) f( D$ V
WScript.Quit();
# @( F% ?2 e+ c A5 I: i / Y5 j! x: Z7 |% o6 m a4 ?/ G, E$ {
9 a: I6 |5 k$ N5 |$ K
function RemoteControl_SimulationFinished() , T$ w& o& z v( E+ |4 r6 o
{ ) t- `7 Q# p' }6 {3 h
WScript.Echo("Simulation Finished!"); |