Example of a JScript
3 t% q/ [ X+ U1 i) E+ {var vbOKCancel = 1;
" ?! m( K) @6 m1 d: C1 Pvar vbCancel = 2; ) g$ B4 f9 `( T( I7 ?
var vbInformation = 64;
" E+ q4 P6 M7 A, X6 X+ Z% D3 kvar Finished=false; 2 y8 _& f( W; A% w- z
3 G1 U- m* S: u1 I4 a9 z$ \
var WSHShell = new ActiveXObject("WScript.Shell");
6 D: p7 W0 [+ W/ ~5 t5 R" N 5 ]5 Y- z8 |3 b1 x& U$ n
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ( [5 w" L, P7 e) I9 r
) z% F h6 C# \0 o* { v
simple.SetLicenseType("Runtime");
& e b. Z0 w8 @, V
8 L0 f1 K0 b5 K' Qtry
7 Y5 B% ]$ o* L{
G" I: w* S- K9 I& z9 g // Enter the path to a model file!
2 c- v7 G8 p+ s3 E6 {8 d simple.LoadModel("C:\\Models\\Test.spp");
, T, Y& N* n# G6 R} * l* L5 c$ c6 }
catch (e)
$ _, e3 E, \1 n) Q/ L$ m{ : O; {. H) j1 H8 o. u6 r
WScript.Echo("Could not load Model!"); " |( [0 W0 v; y3 S* R7 _
WScript.Quit();
) f" L! T) K* k}
; X& Z' _) O F 9 w Y: g! |/ H3 O0 X- t$ y
try
# n9 s' R4 y! @4 V0 t{
5 d6 h2 @+ M7 e simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { - o) f- i5 E- K% `
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); . z6 H9 R0 e& S7 n0 p
if (r == vbCancel)
0 Z/ L) ]+ I% N: Y7 f { ! R& N) h2 K7 s
simple.CloseModel(); 3 W: f. S3 L, H0 t; }4 a- u
WScript.Quit(); 6 z( N6 q# O l, R
}
P3 J8 ~ q/ Q" I) t4 u/ P}
' k& y; ~3 p$ K7 ^4 L' H
2 R( h4 R' }4 O6 \' I0 B! S; O7 asimple.StartSimulation(".Models.Frame.EventController"); 9 p2 p* Y" k3 E) W5 r( {- X
4 x+ p- Q2 R* B# V. }" \/ c
if (simple.IsSimulationRunning()) $ c5 M: J! Y. c8 N, o# k1 p- o# U
WScript.Echo("Simulation is running!");
9 B& b& a) Z* I% i( S0 Q
! Q$ V7 V# I& b3 y) ?* c' W& y% O: \$ h// Wait until simulation is finished # S7 F# W5 Z' |9 L" `8 l
while (!Finished) WScript.Sleep(2000); * S0 }% }$ C" b. M2 N
8 P! e0 v, t$ ?: g# w4 }simple.CloseModel();
% i: d9 A+ Q, ^( \3 J0 Asimple.Quit();
1 I i5 U# P4 i* }: XWScript.Quit();
2 z) k- w! }0 O- T+ Q * V ~4 i. Q6 e2 X* |
' m- a# Q5 M! p+ x! t' o% b
function RemoteControl_SimulationFinished() : h6 [& [2 |# r7 g4 T
{
# a5 e1 @9 A, V2 |5 _' G WScript.Echo("Simulation Finished!"); |