Example of a JScript
; Z8 F6 d% X+ cvar vbOKCancel = 1;
7 \$ C9 Q% R+ c* N+ Tvar vbCancel = 2;
( w" o$ t+ N: r" {# }* i6 tvar vbInformation = 64;
! f9 k. ~# t& v% l: T7 V% ?var Finished=false; , v6 w, w1 t8 o& u1 j+ [
. m" L7 ^- s. ~$ |) A
var WSHShell = new ActiveXObject("WScript.Shell"); 4 e! c: [% q" u$ R, g0 {
# q- s3 b/ p$ B3 b, _6 J- pvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
7 a% ~5 r% q( t5 e 7 ~' I. S4 n1 |/ K+ G+ y( N* ~
simple.SetLicenseType("Runtime"); 1 r' t8 j) Z8 F# V: U7 M! F1 ^
9 j. k, G2 G* x8 c
try ) H, [& S, v- A1 k( A ]6 v
{ , `. w/ D. e' M; _
// Enter the path to a model file!
; N% t( ^- W0 [5 e+ n; w4 { simple.LoadModel("C:\\Models\\Test.spp");
: i/ Q, V7 \+ Q# X5 X. [& \' H}
$ f7 q: F9 G4 l/ N0 g8 ecatch (e) ( Q9 ]2 Z }3 m) N
{
. `; K) a9 _8 |3 {0 C5 Z1 o WScript.Echo("Could not load Model!");
! L0 X. M( h" h+ p& E* C9 a! K WScript.Quit(); 5 j1 |$ b) z& K
}
" p3 ^: m) l# N2 g: M % Y2 R$ U# I* V& ^: G) s
try
+ ~) p! j$ A1 r7 c. w) F{
9 l2 t9 t% g" f simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
; B) w7 t6 n* u! m d r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 3 J# i! r; B: F& i+ P& Q
if (r == vbCancel)
& ~6 w& e+ C2 ~/ ?: [ { 6 E$ J' E' m$ y
simple.CloseModel(); $ U' y& d9 s% `
WScript.Quit();
$ C; r$ i+ R, J7 ^$ r0 [+ g }
; m/ c$ Y& P" Q2 B2 F1 N# F# n}
, D$ t, k0 {& w Q3 a, R6 ^3 i $ ` x) I% ` ^$ [& ~! C: {
simple.StartSimulation(".Models.Frame.EventController"); ( J+ q' l5 [' T' a
# Y5 M; d* B- |$ v2 h' M
if (simple.IsSimulationRunning()) 9 b" F) n# Y! E2 a( u* s
WScript.Echo("Simulation is running!");
: `, l& d& G3 j' _5 D1 ~
! }" ]4 D. F( _* D// Wait until simulation is finished
/ M, ?! e7 J. ^/ c! fwhile (!Finished) WScript.Sleep(2000); 8 h/ {4 T! \, v& g! Z$ N8 I
- {& C, E2 y) j3 B& ]simple.CloseModel();
' ~* s8 l# r* H6 _, Y. A9 ssimple.Quit(); $ p C: y5 m/ _7 _! f6 Z
WScript.Quit();
$ p3 M# c7 s3 F! R
1 ], }# G& i2 g( Q, g0 Z ! V' }5 l( @/ W! U$ Y& {2 m' h S
function RemoteControl_SimulationFinished() ' a3 ~- ]7 E7 f3 W6 L* w" _" o
{ 1 Q& r6 G6 R+ g# L
WScript.Echo("Simulation Finished!"); |