Example of a JScript h# L _1 U) p6 G" S1 f
var vbOKCancel = 1; ; Q( x- t( x6 G
var vbCancel = 2;
% l/ m& K7 l, B1 S3 E* Jvar vbInformation = 64;
( F% t6 i" I5 x4 R( ]0 K. d/ D, Xvar Finished=false; 1 D c+ g6 c. n7 v; U" h( ~
! y4 p5 ?3 a# s* H9 j6 }var WSHShell = new ActiveXObject("WScript.Shell");
+ t) `% H' K1 Y3 n" \
; Q$ h) r# O1 u) Ivar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
# @4 N' x: m6 } 3 O5 m. h5 O% V/ H, n* K6 n4 C
simple.SetLicenseType("Runtime");
8 a% r Q! r4 a6 e # q) M/ \7 I( u) r, K X: s2 w
try 0 x4 M" e4 a% C+ T2 U) V
{
3 {: y" e- B) W1 z // Enter the path to a model file! 4 F4 I( d5 `9 A& s' i. P6 f
simple.LoadModel("C:\\Models\\Test.spp"); % i; w. L8 i; W5 T
} 0 V4 k! m1 `7 h) @$ k5 C6 G' x
catch (e)
9 w% F8 R+ a+ U{
8 J! c( W* o7 ^% f WScript.Echo("Could not load Model!");
) @5 [8 U2 Q" i1 r/ O* u3 e9 G1 G WScript.Quit();
1 t5 E; H0 O) j9 f. j} % i+ d% L) l/ ~
. \5 t5 q" x7 K: i$ @& D
try 2 ~+ L- Y% i \ \: u* \" T7 ~
{
% ~" x0 B: W- C simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ' N' E, E5 k4 `& Y7 e
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); + q5 V! u( {3 w5 B. t# K/ X) O
if (r == vbCancel) - n* U- e2 [6 J8 h" L! ~+ F' m" Z
{
8 |! Q! r s5 ] simple.CloseModel();
' Z/ d' Q" |% } z0 ^; O WScript.Quit(); - X& }7 F' c- J4 |: q6 P5 ?
}
% X9 | }$ K6 h, m" S- h6 S} # z( o$ W4 Y( `( f7 X9 B2 X2 G# [
- [( i4 ~$ `. w. U3 [9 l! Q
simple.StartSimulation(".Models.Frame.EventController");
* q5 }) G, y5 K$ t: H, R # I: B+ R+ Y7 \" B" g
if (simple.IsSimulationRunning())
$ W9 B0 A! u" u" p$ _ WScript.Echo("Simulation is running!"); / z0 `' O. T+ r4 e# m6 Z7 r
, f1 q2 v9 r3 }* F
// Wait until simulation is finished , l$ S4 q4 n3 L6 m! e. z, J' H
while (!Finished) WScript.Sleep(2000); : \; r- F+ h% p* ?; H! o6 e
# c9 g" Q/ }6 z" f! H
simple.CloseModel(); 1 \/ m, A p( F5 c- M% U( P
simple.Quit();
6 y+ \; ]- \+ ^- m! Z( w, e& f9 Q5 BWScript.Quit();
" i4 o5 t; |5 P6 O- h! {. { 7 v- Q6 U7 A% _7 R! S0 S" U
& \4 W* \' Z% F, w8 @1 P- V7 h
function RemoteControl_SimulationFinished() ; o: E j, @- |' W \
{ : s, N* J5 q' l' L1 ~% V; Z$ U$ V7 m
WScript.Echo("Simulation Finished!"); |