Example of a JScript
& N% [; L8 P9 M3 Tvar vbOKCancel = 1; 8 M8 t0 r3 _! P) Q- P5 a
var vbCancel = 2;
) w0 \8 G4 @) o' p( c" ~var vbInformation = 64;
. P0 L0 t/ x4 ]% _( H) dvar Finished=false; , E- W7 k( h. {$ E
3 _1 `; m6 w, ~& U: c. d! w" Vvar WSHShell = new ActiveXObject("WScript.Shell");
9 d; w. L4 O1 b7 d. t8 G
- T- G2 G) ~! M+ b8 vvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
) [6 m' D* d- x* ]. `
! d) B2 W- |2 Qsimple.SetLicenseType("Runtime"); 1 g9 ~3 w& m1 B
* w" m4 T3 U. H
try 5 J3 k8 v+ f7 i: s
{ 8 _, ?. l. c6 ?5 l* ^
// Enter the path to a model file!
) J' Z+ X* V2 {6 P* X simple.LoadModel("C:\\Models\\Test.spp"); , q) `2 u1 \9 {; w9 m
} & |, {5 E! n. L! g
catch (e) % w0 e. U4 z" ~& d
{
9 T9 U; r2 _- L) T WScript.Echo("Could not load Model!");
+ \! D/ |( u- O WScript.Quit(); $ ]) e$ P* H8 O5 F
}
7 K3 l) h$ ^) k2 G! ` / y5 a+ i! [$ o2 ~
try ! c9 n- x# f1 O" V* l, O) R
{ - t* v) q# {" Y$ W2 u I* {4 O( c
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 5 S! C' N7 s& w; b* p" P" u
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & X' L; a4 @! r' V% y+ D
if (r == vbCancel) 5 m& }5 E& k4 V+ I3 Z# n
{
9 t5 [9 v' Q3 Y simple.CloseModel(); 0 z! O# s" d2 m5 m9 F
WScript.Quit();
6 U0 r7 C+ l0 s }
# A5 E5 M3 h f7 e; ]' H9 r}
8 {$ ]+ f8 y0 P& X7 g # u2 ?" Y* c7 |# ?* j5 _. C
simple.StartSimulation(".Models.Frame.EventController");
) Y$ s6 l8 p+ M/ S! R4 y' z
+ Z5 B4 V- F" V9 J6 ?if (simple.IsSimulationRunning()) ; ^- z0 N5 U8 `. n( I* b3 ?" f
WScript.Echo("Simulation is running!");
4 f+ v! j1 K n9 v , s1 u/ J f& k x1 j d
// Wait until simulation is finished " P' [: `% g, v l( O3 E
while (!Finished) WScript.Sleep(2000);
. S% \5 z- T! E$ [ " H, ]: I6 a4 \7 x6 w
simple.CloseModel();
. a7 n$ }) M3 k+ k, h& j% @simple.Quit(); 3 G% I% V% k& Z6 n
WScript.Quit(); " M+ b7 t' ]8 D5 a) d
* i# [9 N% Q3 C* n
" s+ }; |/ i/ M! `9 b4 c' v. m+ t
function RemoteControl_SimulationFinished()
5 P @( }6 N2 E- W' F" n! i{
% G: d3 H- B! h( P* T1 r! ], q WScript.Echo("Simulation Finished!"); |