Example of a JScript & R! r# M9 g0 R J( l( \
var vbOKCancel = 1; 9 e+ c( N5 ]# H J6 z
var vbCancel = 2;
+ A4 n5 h& q* @/ H2 Y, Uvar vbInformation = 64;
4 ?1 o' i* y% W. v W- i& L% Uvar Finished=false;
; _: X. u& s) n6 L, p. C
9 n1 B* o$ A. ^/ G- |% n2 Kvar WSHShell = new ActiveXObject("WScript.Shell");
9 A3 T) G6 M9 @( E - I7 b7 O0 x& g% N5 X
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
1 g( V- M) }7 `1 \0 ~ \* U; ~
$ A; ?( o1 Y, n; F8 \* Nsimple.SetLicenseType("Runtime");
) f! w6 z( {# @" s# U. Q1 I 9 L! A1 T- b. G( F5 s P" x( q
try $ [4 A9 H5 |9 Z% \1 w
{
* s3 w5 Y+ `1 W; q2 O. |6 c, r% K // Enter the path to a model file!
7 ~3 g3 J) h1 d& ^ simple.LoadModel("C:\\Models\\Test.spp"); 5 M9 c* z2 _6 g( _
}
) r# t8 ?2 B% p4 w. ]$ V/ w& D, x0 ~catch (e)
! w" \) M9 g! x6 i% S3 o, q{ + Q! U L/ ]- M) m
WScript.Echo("Could not load Model!"); + @6 H" T4 l$ [7 o! r; o e
WScript.Quit();
, d" E6 }7 B5 |2 u/ y}
6 Z8 A+ ~$ t: W) X# Z
6 U6 l$ O6 X3 E2 ^2 B& Gtry
, A r$ ]' [; Z. \{
) _- J2 [( Q( ~4 o simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
# [7 ]' w0 A! ]* V r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); % r$ \) H8 S; r. S# [8 b1 j
if (r == vbCancel)
# z* A5 k; W" x+ C( Y( [ {
]9 P, D( ?1 _) | simple.CloseModel(); $ o9 P$ f$ K+ t& x
WScript.Quit();
7 ?" \. u2 Z5 ? } * P+ m' M4 K* q0 w- ]! V. s
}
9 X# v6 p- _/ u6 F% }0 G % }5 e) y- J6 D1 N. c$ |" s
simple.StartSimulation(".Models.Frame.EventController");
7 K8 k: @8 U: C9 i
3 @, n0 i Y3 `9 Y' Q# Iif (simple.IsSimulationRunning()) & L& D# m4 Y3 E, |
WScript.Echo("Simulation is running!");
6 B( S( w3 F8 B: W
. I, s, [& z! c$ c- B/ }. o// Wait until simulation is finished ! W- ?* V' a4 U
while (!Finished) WScript.Sleep(2000);
1 |. m: O# X" c, P1 C. u& i% Z
& y: J* X' j9 j6 lsimple.CloseModel();
* J& J" D, K# q2 m) p6 ~' Gsimple.Quit();
/ Q" w7 t0 {( a7 \! j& YWScript.Quit();
+ O% c6 T: a8 D% p % A( ~8 [ @. K9 W
3 `2 b5 I6 S3 P( Y
function RemoteControl_SimulationFinished()
, O; y+ z$ Y# Q% P$ E{
; R- @# F a: j7 X; k, T' j! @) | WScript.Echo("Simulation Finished!"); |