Example of a JScript
$ R c2 f6 ?' V i7 Z6 M+ |- F, Qvar vbOKCancel = 1;
. @2 \! E% W6 v4 s/ m& Yvar vbCancel = 2; : v- U6 `/ H( m) @! a. O2 I
var vbInformation = 64; ( D) m* w" e+ [5 |3 r! c7 E3 z
var Finished=false;
* y/ U+ m7 F1 w2 } # F. Q. g+ m! Q, {
var WSHShell = new ActiveXObject("WScript.Shell"); , u+ ]' N+ A( t, G& x
, x7 ~; e* e& Z7 N: j/ Hvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * a2 c H8 j- y0 W
1 B7 G3 e3 ~4 g+ a5 Y$ usimple.SetLicenseType("Runtime"); - d$ Q6 E, V( {! g8 b3 V2 X
0 b! m _9 s+ W, b* e! F3 Ztry 7 Z- P( k0 P: o: o9 }9 _
{
, }) ^, B/ E+ @4 G$ C // Enter the path to a model file!
% v' Q1 [1 j0 x% X g simple.LoadModel("C:\\Models\\Test.spp"); + c; t- [9 y' m
} : Y q3 x' R1 H; n0 h
catch (e)
% t) X6 Q; u/ x( e; ?{ " ]% I: m! J' X+ j2 E% C8 P
WScript.Echo("Could not load Model!");
, @; U( W( [; Y# v- ?; m) q5 _ WScript.Quit();
& O: o+ h# l+ B9 B}
/ o7 H+ y }: q & h5 u( w8 U! s1 B
try
( d% o5 ~- [5 K8 B{ K& j2 H, b i( e1 `# N8 R% l
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
# P, A& l* ]# E r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ) R* |8 J5 B3 T! m2 {
if (r == vbCancel) / m9 l( A& E1 _/ {
{
' p) E. B B* c7 i& W. ` simple.CloseModel();
2 a- G3 q/ I( B$ V) v$ Q1 q WScript.Quit(); ; S( ~& K9 A& z3 Q: E) t
} $ t4 B* X8 \, o$ W
}
4 h- \$ T2 `( `9 c& Q( L" Z 7 Z* n; m) K, @: y3 S$ M
simple.StartSimulation(".Models.Frame.EventController");
+ s* Z5 z& o0 i f$ u% ?$ Y
6 H- t7 X3 J% T n% v! H: F) ]if (simple.IsSimulationRunning())
- r1 B0 x) U# g1 e$ m WScript.Echo("Simulation is running!");
# d# l) k" ]6 s2 C9 H5 L1 Q % T2 \, F2 M8 N( r& m8 [$ t. f
// Wait until simulation is finished
3 O+ P% Y; t8 x5 Qwhile (!Finished) WScript.Sleep(2000);
$ F5 E" J& |3 L! q- F: U& I8 x8 ~
+ Z6 }. q- F( h' E, jsimple.CloseModel(); ; y" |8 R( J1 A' A+ g5 y5 D2 x f
simple.Quit();
$ }" t5 P% }7 q& S' dWScript.Quit(); ! E% P0 z! f& [ t1 H
7 h- e0 }8 P0 }' h- h! H
3 q4 _3 Z6 N: y0 K& gfunction RemoteControl_SimulationFinished()
/ W8 R7 t m" o" N7 l) S6 ~{ 6 J- N$ M2 m+ ]+ y
WScript.Echo("Simulation Finished!"); |