Example of a JScript
5 w& t9 E4 c. x6 P' L4 kvar vbOKCancel = 1;
2 y9 R3 Q9 A- Rvar vbCancel = 2; ! I) i8 g" p) J, J3 |
var vbInformation = 64; & C: o& \7 V8 a/ r7 J$ v" ]) o& K
var Finished=false;
9 q, a9 q1 A2 ?3 @9 O1 k' C# ^
. M1 u9 {$ \ ]# Y! F! K+ Mvar WSHShell = new ActiveXObject("WScript.Shell");
, [1 d5 _1 G) a, @; a# [ # f) g5 F4 `- u$ k# z: B' U- {
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
& m$ j* X, A, h1 h8 ` 1 j7 h" J* a4 [8 C3 }# @+ M
simple.SetLicenseType("Runtime");
( R+ L# K7 C5 B3 ?; E8 i2 [
/ K. E/ `" D$ @9 U2 X5 d% htry
+ B$ ^2 n. x( |{
: E& s$ A+ v# |4 A6 u // Enter the path to a model file! . J# i' W0 \5 R3 q) g
simple.LoadModel("C:\\Models\\Test.spp"); 1 y; ]$ N/ e+ B4 s3 s
}
1 C$ {# e! Z* L# c* Ycatch (e)
1 o0 b+ e0 q, ~: u8 l1 L. v; m3 P{
5 a s! r$ I1 @/ w( t WScript.Echo("Could not load Model!"); , p1 c7 s) J' O9 D6 c
WScript.Quit();
% x# K0 S! u/ i3 J} * b1 H% D$ ]8 S; g$ {$ s5 e3 B
0 r+ E& \( q$ Z& @9 h
try
# u! n5 V2 P1 j4 T/ U: \# D; k" i4 X{
3 B: b. J3 V$ I% U& x simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { & L; h3 [5 B: |9 H
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); / `( q, B2 Q! ?+ a8 g
if (r == vbCancel)
7 i: a2 N8 }/ v# N# k9 P { ) ^: z7 ] c) O3 [
simple.CloseModel(); - [4 b* E3 c* q. O5 g4 O
WScript.Quit();
6 N5 ~/ R% k) g; U# B }
& U0 }$ y6 l6 e3 o0 c1 P} & A, Q- d O( k% f( u
3 p1 s' p# R- Y6 q6 M- Xsimple.StartSimulation(".Models.Frame.EventController"); + |) K$ o* g* t) V& y u
2 l3 x3 ~- y+ N8 h& [1 Iif (simple.IsSimulationRunning()) ) B- S6 F. V) ?& _% _
WScript.Echo("Simulation is running!");
# V/ N) i8 P% b, C' d8 ?& a4 b ; P& U9 }- w8 u$ t1 y
// Wait until simulation is finished
+ }4 u9 D2 z) J3 g0 H) J( twhile (!Finished) WScript.Sleep(2000);
7 \. l, @( i" H7 X0 L. t4 T; t) v : n( D* O$ @3 M" d5 B5 _5 y) |
simple.CloseModel();
. r% M; A( j# c1 H. ~7 ssimple.Quit();
7 V B) L( K0 H0 m) A6 J) o- f1 wWScript.Quit();
5 X% s- R9 S# g; h- Q4 _9 X
% X, R# ?; g% `* b+ n 6 n# ]+ V$ L4 D0 X& c" M
function RemoteControl_SimulationFinished() + {2 o+ `+ b( P! @( C- |
{
. Z1 I9 X) b% E7 v* L" | WScript.Echo("Simulation Finished!"); |