Example of a JScript
' k5 y3 r* [& Qvar vbOKCancel = 1;
/ c3 \7 G" A7 dvar vbCancel = 2; ( _8 O% c# k8 \
var vbInformation = 64;
8 s3 H" Y6 W( s) A4 \. Pvar Finished=false; 4 K! v2 J0 s5 w+ {! |' R% C7 w3 Z
$ V q1 K4 b# w
var WSHShell = new ActiveXObject("WScript.Shell");
, s$ n& a4 R! L3 X4 ]/ G+ u$ C
; u' y |6 b$ c8 Gvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
3 z$ S9 w8 Z7 ?) s
% H, d) }7 k2 Msimple.SetLicenseType("Runtime"); ) X: x# ?- J) C1 {4 [7 d
" P5 R! t' \4 P) ]! x
try
; m. M2 j- B6 g' s2 m0 ?{
3 L3 e4 d4 B5 r4 k+ G3 P' ~ // Enter the path to a model file!
% e% n4 T6 \; {" n/ k H: t R simple.LoadModel("C:\\Models\\Test.spp"); 9 H, o( L8 I0 X9 ]' h: n' K) U
} $ a, @# D0 \& S7 c# P% a4 H' Y1 C! a
catch (e)
! d- b4 Y& @$ F' l' e' F6 T& m{ + N, ^0 [! K- h( ] c
WScript.Echo("Could not load Model!"); # L8 O ~" i, x& P! q5 F9 ^+ L# T- `
WScript.Quit(); 0 |+ S t! ~4 S1 u, D$ T, X& e
} 4 |; q: J0 \0 ?7 C5 y
6 p) o/ w3 j( T+ }. ?" y1 ~try
. @7 w& X2 z) }{ 8 t0 b; t& Q4 D7 N& [( B9 s
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 4 }9 r: ?% g; ]( i( U+ l
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
# X7 @8 x6 h/ j if (r == vbCancel) 5 [+ s# i3 ~& y( w: t) \
{ 5 q) x& ^& M" W3 C
simple.CloseModel(); . z, A+ e1 D$ V" Z
WScript.Quit();
! d! Q* ]: y2 \' W } ! i% C6 V7 E# w# z0 Z3 R3 F
}
/ Q/ N# |0 ~. p3 C+ z/ M; o J1 P0 G+ {) I
simple.StartSimulation(".Models.Frame.EventController");
- N* N; f% T$ d1 q- M' C
& m+ {) a9 X) x" L' x$ Rif (simple.IsSimulationRunning())
& l( `2 z% y7 q. p* T, ^ WScript.Echo("Simulation is running!");
( Y" w( k/ {# d1 I& j
1 o2 t) J* ?; n5 @; U3 D// Wait until simulation is finished , Z% o% y* D4 L+ O
while (!Finished) WScript.Sleep(2000); 6 E$ E- m6 g) T% M% f* c4 f
; J' z# b4 C# b# F# qsimple.CloseModel();
! z9 `* t1 [+ p' m1 A: [simple.Quit(); 3 P6 j0 D+ c" n; r/ c" M7 v5 w# J( P
WScript.Quit();
. ]% _( S1 M ?; F
% n1 p7 l$ i5 j9 {! J" O; e
8 @; [/ p0 E( R. N; I" ufunction RemoteControl_SimulationFinished()
- {' S8 S5 c0 l: v: i5 C2 r{ * J9 ?3 r2 Y; ~+ f
WScript.Echo("Simulation Finished!"); |