Example of a JScript
$ [7 f, B+ y$ J6 Z rvar vbOKCancel = 1; 9 H# n z( A. ~5 {
var vbCancel = 2; 7 e# X U# J) P" G
var vbInformation = 64;
, j; z$ G3 H' }9 ?7 J+ [& ^var Finished=false;
2 R1 }& Q" ~; I _1 v# C! S; x
9 j/ V; H6 a" P, Y! @var WSHShell = new ActiveXObject("WScript.Shell"); * P w7 d# e2 c( k' t6 C4 I
& ]5 |3 F% Q+ i7 p: {
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
3 G. Z' C- d/ x3 T
6 m& K: Y; D6 V- Y, asimple.SetLicenseType("Runtime"); ( A" U o4 J$ i
2 } ] l/ R. etry
$ \ v6 ~4 ^* G{ $ |8 W0 y8 X) B! r) [3 K( X
// Enter the path to a model file!
( v# K2 f5 z( Z* i4 t simple.LoadModel("C:\\Models\\Test.spp"); 6 y1 {( ?. Y/ {8 q' ~/ f* A
}
. q$ Y- |$ d# a! \: Ncatch (e) % |8 B) `0 K5 K9 |
{ ; e: w5 F1 Q3 s$ y
WScript.Echo("Could not load Model!");
+ s1 Y! a, d" c, H/ E; C6 Q f7 A WScript.Quit();
% B9 a3 D$ K+ p) N} + P4 B+ Y: U/ G/ R7 J; L5 v( f
8 Z+ n0 o5 Y! M h9 |) b3 |
try 3 B" s9 F$ ~- P; L; h
{
% `9 P/ ` a6 t5 l9 E simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 7 `4 d$ s$ Z1 `9 n% v/ n b
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
4 D+ @5 k4 f8 m, n2 _3 Y' N if (r == vbCancel) : C& |1 g0 f) _
{ / @3 r e& o% D9 w {+ u
simple.CloseModel();
* u0 F9 i9 ~( P7 D WScript.Quit(); ; b4 N5 W- c4 m
} 3 `8 j/ k( V1 }9 G
}
/ j% y3 d/ b3 D2 l; g
3 W6 i- o$ u7 |simple.StartSimulation(".Models.Frame.EventController");
" E: A& X' v! _( D
4 V: ~ ^! Q, c7 Wif (simple.IsSimulationRunning())
) g) T( e4 _$ i: g' g% U WScript.Echo("Simulation is running!");
1 i6 E' V% k/ K9 {& G
6 k# Y1 g! b; T2 j6 t: y7 V// Wait until simulation is finished * D% g, E9 {7 o; P) i2 ?; J
while (!Finished) WScript.Sleep(2000);
# p, y. X$ b$ D* _8 z $ ~. |0 l, ~' G. q0 S
simple.CloseModel(); / z2 |' V; Y2 g
simple.Quit(); : J. d/ E9 Z) v' {. e7 L8 K5 ]( x
WScript.Quit();
6 l( s. N. ^% R: J1 O ! e& x+ D4 H( }- h3 L8 W
4 i L4 Y* s+ U6 q" ~- Jfunction RemoteControl_SimulationFinished()
4 \" H* W- M/ I# G{
6 R2 s/ Z& C6 @; a' E! o* B WScript.Echo("Simulation Finished!"); |