Example of a JScript - {( o D- c7 `: ]5 V" B
var vbOKCancel = 1;
% g: l% \1 t# g; [ C s7 Vvar vbCancel = 2; ( {9 Q! I# G* B, d/ M
var vbInformation = 64; - L3 G. l& G! m
var Finished=false; 2 }5 j7 Y1 }2 L
* c3 J( y) E: F; z9 ~var WSHShell = new ActiveXObject("WScript.Shell");
+ t. ]# p. D9 \$ p6 _1 v5 ~
) I- e Y" {& b6 w8 L& R& E* ~- qvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 5 X* M& ~! D" ?& N4 }' ^" l# Q$ v
8 [8 H* }' l$ R% ~1 d4 `) F! Gsimple.SetLicenseType("Runtime");
& q% I0 X4 ]5 U3 N
+ E# Z7 ?1 F8 s/ I( a( ctry 4 R# i2 W* Q: T# y; H0 k
{ 3 F* d# y9 [* s; e) ?2 r
// Enter the path to a model file!
' E+ u2 l' b# N6 ?' ~+ G: k. H8 g simple.LoadModel("C:\\Models\\Test.spp");
6 j2 S# w3 H4 ~3 T1 M4 }}
& `6 k* d. f" b1 U vcatch (e)
7 _+ d* Q& r6 d$ C2 `8 Z# t$ O{
, n+ [- P e( c( ^ WScript.Echo("Could not load Model!"); F! a4 u1 P$ ?$ W" s
WScript.Quit();
2 _2 n, \, f! d3 T" N+ w} 7 C7 ^' M" c+ h/ Z
9 x4 P' g/ V6 }# i: @1 Stry . G/ m' N$ k" h2 Q9 b5 K0 r
{
+ s7 N& [: s. O! c simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
6 C$ C$ J& c9 A" Z$ O r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ! k& P% N7 ?' h1 `
if (r == vbCancel) 6 u8 O+ ?( a- O- B5 z
{
' w; }& F+ O, C& H. M7 O simple.CloseModel(); ! r! w$ s' C M9 h* |3 Q$ N' V# [
WScript.Quit(); . o# q8 H6 U, t" V
}
3 K* O) J; ]8 f9 N& [* C}
1 k% u% \- X- N8 S
! N- O q& A7 i J" Esimple.StartSimulation(".Models.Frame.EventController");
+ y p! J0 A6 U1 s
" b R0 w# ] h- Q) eif (simple.IsSimulationRunning())
4 P2 V' b% w. |8 b/ ~, a( U9 c WScript.Echo("Simulation is running!"); 2 l5 J9 S; c& W7 m2 p6 u: |& t
6 Q# ^4 }* A( [/ H. T// Wait until simulation is finished * q5 c! x8 q/ d8 Z: n& N1 `0 O
while (!Finished) WScript.Sleep(2000); 0 w+ C# H) e, e) y$ N6 R: k7 w
/ E- \# }; `' e
simple.CloseModel(); * V8 A! v' O0 M9 L6 {
simple.Quit(); - p @" e" z$ ?3 }% U) i4 d
WScript.Quit();
9 {9 s" v% d- r4 f1 c " T( Q% z& N( s( s& J
5 P( O/ a' E, |
function RemoteControl_SimulationFinished() % S; @: s; G" u3 n" T6 o$ N
{ : P& m1 |2 H* O: s2 I
WScript.Echo("Simulation Finished!"); |