Example of a JScript " h: @. j2 f& I1 P3 p. F
var vbOKCancel = 1;
! C7 {; O, w) Nvar vbCancel = 2;
1 {2 s" @1 y: r/ b2 ]var vbInformation = 64;
; g& i/ Q. o e# e/ m wvar Finished=false;
2 [6 @, z- b/ ^( l9 C; x
! b9 f+ z0 s: K7 A- J5 c yvar WSHShell = new ActiveXObject("WScript.Shell");
+ x. f O, ]- x, d7 B 0 G! y- T- [6 y0 G
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
, n) q) C" X, I( r H
T$ B( A+ {4 n% t; `simple.SetLicenseType("Runtime"); + U' {7 K! t# E& z
" |5 ^ s2 G8 Qtry + r" M4 ^' n7 S( ?3 ^
{ 0 ]: h4 n- L1 U
// Enter the path to a model file! # B w6 ~1 ~$ V$ G
simple.LoadModel("C:\\Models\\Test.spp");
/ _. l7 q/ K9 Y) F+ O8 j2 c}
$ C2 ]. g: X$ v5 T6 wcatch (e) # O$ {) @: C2 n, g0 F$ A
{ , @1 s# U. c" P6 c, d3 u" c |+ @
WScript.Echo("Could not load Model!"); 2 M( g$ f4 D' A' q$ J _
WScript.Quit(); $ N* |/ b4 C- P; g; v; N) [
}
, Q- ^$ `4 t( N# _1 S" |& `* n
0 m" J/ z! N6 i/ @/ @try
, h4 e$ R( L) o0 a B+ T{
, j4 T. l+ N( ]. g* ^ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
, Q+ B4 v) k, x: V% `7 T% a; t$ f. W r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 9 g' l/ L4 _3 }9 b
if (r == vbCancel)
5 B0 S: O% p) | a9 x2 g( F$ Q {
$ K- Z1 \4 i9 a* e @) r simple.CloseModel(); - [2 ?9 X7 d9 H) h. M0 g8 N/ E! M9 U
WScript.Quit(); 8 Z( `$ Z, {0 w8 |' A6 d* [
}
8 E0 b4 O' Q! H9 ]9 v7 C} - e- u& p2 S, h h J
/ h. U. H1 u2 N) v7 i; {4 C& o9 u
simple.StartSimulation(".Models.Frame.EventController"); , @, R! B8 h) M# \8 r
; |. N' O- j7 |! k- `) _1 ^4 U2 ?
if (simple.IsSimulationRunning())
i1 w5 d- k. `; Z4 ] WScript.Echo("Simulation is running!"); 4 c3 Q8 F D5 O( v1 Y9 p
) k6 ]5 ]8 n; e" @
// Wait until simulation is finished
3 Y5 a1 R( L5 ?5 {; m# j9 S# qwhile (!Finished) WScript.Sleep(2000);
& c9 n: ^+ o y* s8 x: ]: {
/ L- z* y' l& Y2 r' ]) }6 j M+ tsimple.CloseModel(); ^- ^& g5 d* s( F
simple.Quit(); * b& x: c4 Q% W$ H4 T' r
WScript.Quit();
9 m# U+ F) W, [. F8 ?
: a6 T8 J$ A, C: Q4 T* e8 W
" J( L' S3 \8 a; I& k" _$ m: pfunction RemoteControl_SimulationFinished()
5 h8 H G3 _! H& Y% i/ M# }) j# o{ ) ^$ C0 T& `0 E! S! R
WScript.Echo("Simulation Finished!"); |