Example of a JScript ; d6 z1 S! y, O2 ]% F& m
var vbOKCancel = 1; 3 W* ]! M3 y8 K6 l
var vbCancel = 2; $ ^% W+ U) U& O& g6 F, J9 z
var vbInformation = 64;
5 `& T: p/ Z x# }$ I* ^' p9 wvar Finished=false;
& S; f& @! i, R1 x' X3 G) `3 S8 ?8 [
# q6 p! g9 O7 ^0 q, H/ Lvar WSHShell = new ActiveXObject("WScript.Shell");
' s1 S$ c+ d% I6 m. S: s0 g
0 ^% @# F3 B5 T: Q8 {var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; d* P2 a( ~" T; F& { 9 r1 k$ s; r$ K+ Z' i" W/ _- [
simple.SetLicenseType("Runtime");
( W" `6 z2 S a2 B ?( w3 @ 7 \6 z+ K2 I1 W" }. `
try
* _, X8 d, s7 |5 v, @{ . }5 Q" f0 }% O- V! ~4 b
// Enter the path to a model file! 8 u4 J: I. R/ E- E' ]. Q7 ~
simple.LoadModel("C:\\Models\\Test.spp"); 9 O/ D' P2 {" [6 O
} & {4 o% A4 @, ?- `
catch (e) ( t3 q- a1 v% |0 W* h
{
, o! s' U4 |" p* q WScript.Echo("Could not load Model!");
. _4 A X! z4 k0 ?0 V% ` WScript.Quit(); 1 F. n3 x+ a6 h& B7 b0 C
}
4 F9 |) e4 k) Y% N - C: n* x& C' D
try
7 c4 R- C& Z0 J3 h( r, O( }* o$ t& }{ - G& ~8 S; c( @
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
: _* F! y) D R$ S7 U$ m. ]- H9 G r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 3 _6 Y; \- `( a2 `
if (r == vbCancel)
. _1 O1 D u& c) ^" ^3 o {
# s2 v8 R& q8 [& J+ t simple.CloseModel();
! i ?% J+ z8 L" a' ~0 X) g WScript.Quit();
: ?8 p1 _6 o) o4 f }
3 p I8 @( U( M8 v2 G2 T; j} : Z$ H$ q: x3 @9 N
' U. ?& b3 U' S/ tsimple.StartSimulation(".Models.Frame.EventController");
$ Z Q) Q/ B: S; I$ U0 A+ L! h
% ]: b' F/ m- M7 M0 s1 ?* \ Yif (simple.IsSimulationRunning())
) e z5 v9 r0 x/ t WScript.Echo("Simulation is running!"); , [7 r0 v) ?6 S( c& Y
" s' Q8 C! t) C# ?3 y
// Wait until simulation is finished " X( n! n- p) E/ ~
while (!Finished) WScript.Sleep(2000); ' ~# {& @/ x8 a# i
3 Z4 W5 Q* |# S9 w6 G: g* {simple.CloseModel(); d4 v' s( { g* n
simple.Quit();
2 i/ p0 x- P: e* p/ d; UWScript.Quit(); 8 E) J& S4 d* L' ~! y2 I2 X" @
" L( g- n' {1 k7 {, H& F
1 E0 K# Z J% \2 Lfunction RemoteControl_SimulationFinished() 6 m' v. w* s! _7 h; Q
{
. k" V. j o, B0 Z. p WScript.Echo("Simulation Finished!"); |