Example of a JScript
7 d9 O6 Y- [$ w, R; q6 J: e6 T8 Cvar vbOKCancel = 1;
+ M: ~: n3 t6 L1 O; r# c" Dvar vbCancel = 2; 2 Q! R' p4 M$ v: L" B/ K
var vbInformation = 64; % _! Z! M# U& k( |, f7 ~
var Finished=false; 7 X }& A; x' F8 N' U+ o; L
: h0 f) @- H7 V2 j& I
var WSHShell = new ActiveXObject("WScript.Shell"); 2 r! j' l0 |3 m9 W% ]# y3 G7 |
* V* a j7 x. ?
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * }, ?/ p( b A. M
7 b) \/ V0 ~& @! d2 X5 s' D/ T
simple.SetLicenseType("Runtime"); ( N5 }- z$ J3 P
6 z& a% F, Q( s1 R$ Q# c1 [ Z, x
try
' R+ L( H% K4 W6 b{
! U0 U6 x5 f( s& d4 O: v) }( R // Enter the path to a model file! 2 i3 A8 w. ?8 z6 [/ t. L4 ]
simple.LoadModel("C:\\Models\\Test.spp");
& o @8 c4 b+ U$ H, i9 I) f} . [4 p0 g% c- h8 A) G
catch (e) . {) J% w3 l, _ a& c5 Y
{ 2 j9 j0 I5 H& K+ y( v2 o
WScript.Echo("Could not load Model!");
2 @! i( o% C9 c( \ D0 }; Z( s& P/ r8 S WScript.Quit(); 2 a, q# i$ Q8 {% m
}
' b' E* P% L4 k" T5 G8 `+ G6 f ? ( I+ E7 X# m# V* `
try 0 ^- H, [' _9 c+ X) X, Z2 ]
{ 5 _5 G! W! b$ Y4 h
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 8 F: B' M# |8 F1 y) s4 K
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); , v9 O1 F5 U8 U. O8 `
if (r == vbCancel) ! N/ J; {9 }- h/ ~" f$ g7 Q
{
7 w% Z* v! L& n5 ?; N+ W6 J- k simple.CloseModel(); 0 S! J& }$ {$ D+ D
WScript.Quit(); ! N/ ?: ?3 h. C: B F' h" x8 `
} $ A" N3 L- A( P
} " d3 ~6 P+ J5 k) s! Y @6 z
% B& c) c h9 [. q/ Tsimple.StartSimulation(".Models.Frame.EventController");
9 M: r0 \/ b, ]1 Z
/ H) J D8 F% h* ?; U; |if (simple.IsSimulationRunning()) , | I; W! i# T% u# ?& p( K
WScript.Echo("Simulation is running!");
" ]4 }) f- R# J( P) n
0 J4 u. _7 |9 X" ~% C* m0 ?// Wait until simulation is finished 9 ]( g5 E5 ?1 G- {5 J
while (!Finished) WScript.Sleep(2000); & v% u* x( }! G6 ? _
7 o1 `& c+ L7 f! P% _4 P
simple.CloseModel(); 8 S# n+ w; l/ _* L" u% |
simple.Quit(); 5 M2 g& }, ^$ K& Y$ y$ `' W% v) ]
WScript.Quit(); ( {# }8 k7 t, b# r8 a: G
0 ]1 N# A, }& T# g) r* }
% u" I. d6 [5 @; P8 n7 |5 F2 Bfunction RemoteControl_SimulationFinished()
$ V' v, O. ~6 S; f{ * L$ Y" w) f0 o5 Y* ^& B$ [
WScript.Echo("Simulation Finished!"); |