Example of a JScript
. Y; x M3 @+ h4 L) h0 qvar vbOKCancel = 1;
3 W3 H3 ^5 F- J7 ^9 F6 B7 Avar vbCancel = 2;
4 \. } ?/ z! @" @4 Gvar vbInformation = 64;
4 H4 H6 q: r& O4 Wvar Finished=false; % ]% w. J: z0 y. E
+ F2 P a0 w1 ?+ A Z- U. F
var WSHShell = new ActiveXObject("WScript.Shell");
- i; ]1 M; D; u. I2 I" T4 R1 n ' H- A4 u2 x& X/ c: K
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
) I* O- g- F- m1 O 5 w( q' \# q% c# @1 s' d
simple.SetLicenseType("Runtime"); + L. C4 V$ E+ Q: Z! N7 g6 K* s
* C7 F$ t" s& h( l; I1 q- Wtry
L- F- X2 U1 h$ _1 d) w$ {{
- U# d$ i1 k; D4 b$ `5 Y1 `- b // Enter the path to a model file!
; R8 q" T% B; G0 T- l simple.LoadModel("C:\\Models\\Test.spp");
5 J8 o4 L% ^, `- a; x}
. |; c- _; Z& X- i' zcatch (e)
/ C J, O$ t; q( L{ 3 K) O" N2 L% K" |9 @
WScript.Echo("Could not load Model!"); # o7 p8 Z& Q( q N3 }
WScript.Quit();
# N/ r2 D+ z$ C' q* u}
8 u4 c5 Q2 e# s& d% \
) b. ]' G" s7 H1 L0 E# @try ( X, ~' Z$ j; H( F
{
# P1 \1 G0 y$ V: u- i( d* } simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ( Q% G6 ` U( I& g
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
: J ~9 z! T0 u: V if (r == vbCancel)
/ y. R: [3 w, T {
9 V( }4 `7 ?8 C( I8 R6 i2 t simple.CloseModel();
9 i; T- L" @% T* d+ K; z& C# a7 A4 \0 T WScript.Quit();
+ B1 f3 q* g/ N [4 k- I2 E } + J: ]1 @+ w5 K8 C( D
}
: b# b' M# L' K' M% F# Y
) U# o# D, Y" Z! @simple.StartSimulation(".Models.Frame.EventController"); # s5 F6 r3 ], Z% o0 _9 n' {9 o
+ Y* E, w0 g. U, H9 h8 ~if (simple.IsSimulationRunning())
% \2 v* X. i x1 Y8 U$ O3 f4 a WScript.Echo("Simulation is running!"); * o' A$ M4 p8 h0 u/ _1 y# G
% w. E3 x, {# n8 [// Wait until simulation is finished
m# G: X# w D( I& p2 |# mwhile (!Finished) WScript.Sleep(2000); ' [: M' J+ Z7 ^
7 S; }+ M2 m% K1 D
simple.CloseModel();
_" o0 E( W2 Osimple.Quit();
! f* @' y" ]7 S4 r" NWScript.Quit();
# K. ` B# m1 X8 u2 C5 l
% l% I" Y2 g7 W5 H+ o4 @+ V 3 X$ \ B% |, ^. q# ?1 y
function RemoteControl_SimulationFinished() % S: ?( C9 z) [# e* r" P
{
2 e- F7 O- _9 q WScript.Echo("Simulation Finished!"); |