Example of a JScript
$ R6 S5 G, ?0 W! N* Pvar vbOKCancel = 1; : e; @% O+ k' H" G7 j
var vbCancel = 2;
" f, H) a5 t1 G* u3 gvar vbInformation = 64;
. w' H0 i3 M, ^8 d: N$ E2 Wvar Finished=false;
* @& S- V( N0 a. b
9 [( N8 T+ e$ y9 l; a9 }0 g/ }var WSHShell = new ActiveXObject("WScript.Shell"); : Y1 l6 ]* \! ]" | P/ e% z
3 G7 _5 d0 I7 R5 H5 q; u7 n
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
/ C7 w% Q9 u8 p" D; N ) T: v/ ?' u( X
simple.SetLicenseType("Runtime");
% t n" I3 d) y& ]4 y
$ j6 |4 m, H4 Q7 a" P& k, btry
/ N- N- L, f. Y ] E* a0 g' B7 Q{ 4 J$ U5 i9 M9 A5 u8 {- r
// Enter the path to a model file!
. V: ~4 E% |3 _' r; Y simple.LoadModel("C:\\Models\\Test.spp"); 5 |, j4 C0 s# S1 R9 ]7 R
} 9 H: j& Z9 z4 C( _2 O2 l
catch (e)
9 p, @9 _1 T0 i2 L" H{
5 z- z2 n3 i8 w' J7 j/ R1 r1 H# F WScript.Echo("Could not load Model!"); o5 m L) p6 ?2 y. f9 Y
WScript.Quit(); 5 J8 s, V; c# ]. d+ S9 l5 P$ c
} ! Z9 X! |) j7 E1 ~
1 L6 t: [# B, ^$ Q' }7 a9 K
try
$ O* u; c0 x5 `# H0 L{ " d; A/ G. l! W7 T
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 7 b6 N7 [( s' _2 S$ b
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 1 h/ n/ P( g* O, w; ^
if (r == vbCancel) $ }$ T. X9 w5 q0 b- d; o
{ % y6 p% N9 q, C( ?( `( X
simple.CloseModel(); " |& K& T# H; Q; m
WScript.Quit(); 3 `0 V O- P8 H7 U7 U7 r/ F
} # U. j r( l) d2 F1 _6 A6 G
}
* p/ i3 b2 R( e# |% h) p4 x: e; L : R; a1 I, R9 z/ e
simple.StartSimulation(".Models.Frame.EventController");
( t9 F5 @( C- }2 v . n. A! f5 ^, t/ |' ]. s; {9 m( l5 J
if (simple.IsSimulationRunning()) % z. r/ R+ K# E7 `5 Q* G
WScript.Echo("Simulation is running!"); 8 e# \0 R% z3 P
$ ~. F1 f$ p9 v/ j! S& ^// Wait until simulation is finished & o" M- G& B" m$ q; n a
while (!Finished) WScript.Sleep(2000);
: Z/ d* h! ] W7 t- k 3 D8 }4 F# v- u7 i( x! h
simple.CloseModel();
. ` {( Q4 B+ k) r; usimple.Quit(); V, `- r) i$ d) F! u; \
WScript.Quit();
- G& ]& u- _1 x# \7 M9 { 8 A* p6 I0 G6 M# O' @
' {% O+ Q, F2 j7 E( ufunction RemoteControl_SimulationFinished() 8 Z$ m3 S/ a6 R7 f) i
{ # j+ v q H- L& f# h" ~& d
WScript.Echo("Simulation Finished!"); |