Example of a JScript + S7 w7 d0 g# o
var vbOKCancel = 1; 8 m1 l7 g4 U" F3 e$ n5 P# Y
var vbCancel = 2; 6 j( L1 Z9 l- Q$ S# K0 @
var vbInformation = 64;
- ?( T3 P1 U7 x( {var Finished=false; " \* K, R6 W o- O0 D3 z- o" I
, m/ J; r8 o8 h1 }var WSHShell = new ActiveXObject("WScript.Shell"); 0 r+ {; y7 }8 n
6 l$ @! F" {! p! b* l
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
4 r @7 }9 M; A+ R F: [$ ] ; q3 l+ C. G" o/ k, V6 X1 t3 j
simple.SetLicenseType("Runtime"); ; L+ S0 r4 p! Q7 V1 |! |' a* R$ Z
# W5 a# l6 O3 y
try , U( F$ P- x" k# X
{
0 N J, B: G; ~! @ // Enter the path to a model file!
. D* [4 ?+ O& F simple.LoadModel("C:\\Models\\Test.spp");
, u& L( L2 {! }& a. S* L}
# n# T, ~* |( @6 zcatch (e) 7 F$ {( o/ G5 s' s- q$ ~! t* U! E
{ 5 J5 C8 t! t; g* Z4 `" q9 U
WScript.Echo("Could not load Model!"); 9 ?$ u9 g# Z: q ]2 g! s
WScript.Quit(); 1 u- |: K3 p" ^# y0 P0 N9 u' B4 b
} + d/ D, N' W) c7 m) [3 T
# z& b2 |: T' {6 [3 j# ttry
1 [9 u& y/ b7 G6 U# B' ^& z{ " n$ Z1 H8 E% N6 Q7 m
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { * s. k! O- U; s" [' d
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
7 B' {+ Y1 c3 v( E+ r1 m+ K4 Z if (r == vbCancel) 5 h- z+ e- | M {% f
{
$ a5 w; Y; j% b$ |+ m4 i/ x simple.CloseModel(); : b: j3 N" {/ T( D( X/ R
WScript.Quit();
/ S; {( |% S% c6 W! c3 ] S8 N } ' g) i: o q2 K# I% S' Y* F
}
& _! {9 A8 O9 f* @* O+ g! @/ M . M6 }" O& S) K I* d
simple.StartSimulation(".Models.Frame.EventController");
! G0 W6 l" S7 i
/ W' R. X* y( U+ F4 ~' dif (simple.IsSimulationRunning()) 0 q5 I" ~: |/ \% A
WScript.Echo("Simulation is running!");
$ j# Z( p. Y. |. C& M( M) e: `. d ! o# i" Z. g, ~2 P# ^8 y
// Wait until simulation is finished " N# f1 U ]5 L% x3 e# n# s. N
while (!Finished) WScript.Sleep(2000);
2 N2 l4 w3 e0 E/ f- D
2 C* l9 G3 e S+ Tsimple.CloseModel();
. n3 Z& I9 o! N/ ]# s6 Y4 \simple.Quit();
" w+ M% H0 ^4 p/ a. ?5 jWScript.Quit(); * {( q% U6 Z& c+ _- [
: l1 r# K- u7 x8 c8 W
+ O$ \' s7 G( F& C; K) D
function RemoteControl_SimulationFinished()
" T) i. ~' F/ ~7 X7 L- D{ 1 }$ e/ X( P0 |" C
WScript.Echo("Simulation Finished!"); |