Example of a JScript 6 l' }% r+ Y" j# Z# D0 D
var vbOKCancel = 1; * U$ c3 x! N2 Y+ l/ T
var vbCancel = 2;
5 s% ^) n# c/ Q+ O- n3 R" p% Zvar vbInformation = 64;
" f# Y: M9 z; W. L& Nvar Finished=false;
# }. q* S7 @0 H& V" x- b , G; d; e" ~5 V9 y8 O6 U$ _+ E2 a
var WSHShell = new ActiveXObject("WScript.Shell");
J* S5 W1 o0 j6 F 0 {7 L, D; I$ E! h7 _& y
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; ^1 l9 F) g8 |: Q' D4 V 6 D2 j3 o0 L# v" V) ], t
simple.SetLicenseType("Runtime"); & l4 a3 z$ F/ H+ T! Z: x7 b
8 i [& K2 g, E0 v9 Q
try
+ L8 x0 U+ t+ e/ n, h. H{ % I5 ~) J2 ^& T) x4 f7 I
// Enter the path to a model file! 6 R; C/ w! C$ G1 U
simple.LoadModel("C:\\Models\\Test.spp");
" `, O0 d: c" P! _% K7 F}
3 D4 |- \0 ]6 A, _* k. `catch (e) 7 g( G. [; g6 z/ k
{
; Q0 a$ ]% m5 p& a9 Q0 a5 s% o' ~ WScript.Echo("Could not load Model!");
0 s3 M$ L! x4 d; P) B* C% Q WScript.Quit();
8 s7 P5 X) m* }: s6 n}
' F7 B* g- C0 c q# c& D
* T3 W+ @, N7 u h E0 Utry
& g* k H$ H: M{ # o: x# e; x, I4 S) h
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ; a8 B, n7 [+ n; C6 C- h
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
2 {6 _- B# U' |# k$ A7 W if (r == vbCancel) 0 p3 }2 i4 H. `7 m2 j, t
{
6 v0 ]0 {1 G+ ^0 H, O0 u# u2 {1 C simple.CloseModel(); 5 J& _+ U/ C5 Q
WScript.Quit();
2 ?+ Z9 d- x6 y }
k/ W5 L! C, |* Q} 4 S) @ \1 `* U2 I6 g# r9 {. K
! n, G+ s' ^ ^, c& }, q6 n: W
simple.StartSimulation(".Models.Frame.EventController"); ( S9 N8 K: w$ w" z) i+ S
4 ]* @! d7 E) y2 J( d
if (simple.IsSimulationRunning()) $ B8 S* _9 X' h- U
WScript.Echo("Simulation is running!");
6 j R8 ]0 Y. v3 P 5 _, I, S2 X+ e% I& K/ S: {
// Wait until simulation is finished
H5 y! C6 }3 Q" y' Jwhile (!Finished) WScript.Sleep(2000); . o8 b$ f! t6 u8 }% T# ^ }
, B2 |2 \/ H0 L3 m; F) V2 @simple.CloseModel();
; o3 j/ M( O9 T& @/ isimple.Quit(); * i: F, g6 S( H
WScript.Quit(); . a( U/ x' w% P: Q* q
0 l/ ]: I; A6 D2 H# L# @
2 ?+ v+ \! ^8 d3 X, [- ffunction RemoteControl_SimulationFinished() # D7 H3 l3 k: S, f4 ~
{
4 |" o% Q* |- [) ^- q9 L5 h WScript.Echo("Simulation Finished!"); |