Example of a JScript 3 H, n! [* D B" o1 d# f
var vbOKCancel = 1;
; U% w p! e/ ~, Y/ }. p, V" p* Gvar vbCancel = 2; 0 A+ t( h- V% C" K5 ~- z! A
var vbInformation = 64; 4 M2 J+ ^+ B0 x( R. y+ }) \
var Finished=false;
" s4 @/ `- S+ w+ F 4 G8 `, e" _' `
var WSHShell = new ActiveXObject("WScript.Shell");
b$ }$ y8 A7 n. g6 C
& w* `$ H3 @2 W* j) S. f3 @3 l9 ]var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); / f" X0 H" J2 u5 p3 A
; s% h P/ D. t) }# B. F& c0 _simple.SetLicenseType("Runtime");
6 ^# E- r. t; }9 M* N0 W 8 P& L; R; M( e# g* `; h
try
5 z! z6 w) }$ C6 C3 E2 t7 W4 U' x- B{
1 f, M. F9 K. e7 u+ q2 ^$ l // Enter the path to a model file! 1 z# m5 s! ^: `0 t5 Q, ^9 E
simple.LoadModel("C:\\Models\\Test.spp"); & ^6 O" U. S3 Q- R- i
} " R1 @4 d! B8 g
catch (e) / h& d2 g8 ^1 D/ F
{
9 l# U2 D8 {6 |+ a WScript.Echo("Could not load Model!");
; t! u9 T% h0 T1 k; L WScript.Quit();
% F+ t' J# o; t' L0 v} 9 Y6 A3 q# X, M( D$ d
8 s$ Z/ C* @/ ttry
) Y) {% ^$ S) N{
( ^5 z9 Q3 H6 F! H simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { * H, L- O3 x# J9 Q+ D6 @8 a, f
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
5 a6 R, P/ s1 I; v* w5 e4 R, f if (r == vbCancel)
. B, v2 u T/ o3 g7 C {
2 G8 k: D) h: R9 ^ simple.CloseModel(); 4 F2 g7 ~7 Y4 ^7 |. V
WScript.Quit();
( _" h& P) F8 d: @0 D4 J* S }
* k( \1 Q: I ^0 B& q}
2 |0 \ `' Q5 Z& j3 y- p+ |% j# S
0 c8 l7 u. ~- H3 ?& I/ I0 Tsimple.StartSimulation(".Models.Frame.EventController"); $ c9 F8 }# t$ |, ~( S
3 e3 z0 N; b3 F+ I, x. Qif (simple.IsSimulationRunning()) - y, D; `: d6 q/ U( G
WScript.Echo("Simulation is running!"); ! B- w* {0 i3 n2 a
: C/ M) K, ]& q) C6 X9 M8 _
// Wait until simulation is finished ' q! N6 R; C6 R
while (!Finished) WScript.Sleep(2000);
. V1 c0 {5 u5 Y+ O3 N. P , e" G+ ^8 H! Z4 |
simple.CloseModel(); - W' W) a- K( m; I( M: O- F- P0 `, x* |
simple.Quit(); 3 q2 B, X" b6 \) I4 Q
WScript.Quit();
' e) `# t& p, z |: f7 _6 I. @3 [ $ l6 H/ X7 p |4 [' s
! R3 m {7 M) P! F! N/ T" D
function RemoteControl_SimulationFinished()
1 Z) V& U5 c" i1 y. k$ U{ % k- F* m5 Z, ]; z' n" G
WScript.Echo("Simulation Finished!"); |