Example of a JScript
0 `7 S) A" [- Z! p& Jvar vbOKCancel = 1; % ^- I8 E: J" z1 v( J
var vbCancel = 2;
, C* e: G0 X8 R* ~9 _4 l8 A! J5 zvar vbInformation = 64;
) U: o* h- |6 K3 {4 avar Finished=false; 4 |7 p x5 }: E s0 H
; M! i* j2 Z- O" Wvar WSHShell = new ActiveXObject("WScript.Shell"); 1 J. x; q; Y, ~- ~ E( z5 j; P
7 V' h U: x- Lvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ; N3 n) e8 u+ i* g' {; I! B2 ~0 i
+ ]+ L+ l4 F& B8 q& ~# ^simple.SetLicenseType("Runtime");
, b0 F8 G/ M9 C2 N# h % ]" s2 j) ?; C
try 2 L* o, m1 z$ u) m' V% t. ?1 b
{
* ?. ^1 s2 ?; ^4 U6 v // Enter the path to a model file! 9 g( ?9 t) [4 H' ^5 |* \
simple.LoadModel("C:\\Models\\Test.spp");
, i# O* `. o6 a} , g! H J/ o% }' h
catch (e) . s% m. c) c. q9 S
{ $ a& P7 |4 g: o4 p5 M
WScript.Echo("Could not load Model!"); 6 H+ `7 j* D1 m0 x7 L
WScript.Quit();
% N7 w. r7 I( b} 8 U/ Z' _( @, j' W ~" L( a2 r$ y
* r* r+ }. Q, M& ?# [
try * v9 k2 r& L$ X; E b
{ 7 i& y& W( m; g- l( D" |* H: k
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 7 T+ B6 A b$ u5 ~3 i
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); # x$ H0 h' s2 Y' P# p9 r9 p! Q& M6 u
if (r == vbCancel) , B! K2 n& \: L* G6 s+ _
{
- V2 M9 A, i+ P! D' o$ M3 x U- t simple.CloseModel(); 3 ~# x0 e* Y& @; L3 i/ b# H% }4 r
WScript.Quit();
, f8 ^! c- z$ m: l } ' `0 X# `9 A! A y% G
}
6 s) P! \2 s, `# Z: d2 b
. ]3 F: t; _, m5 ]- a6 Dsimple.StartSimulation(".Models.Frame.EventController");
! g L; D4 |7 ~0 W# a - b N/ K7 q K0 |4 }% \
if (simple.IsSimulationRunning())
i& A/ e$ l- f. T0 g, b( h WScript.Echo("Simulation is running!"); 7 m7 |( j: X P F
4 j) K) H5 l% Q! b) z% y// Wait until simulation is finished
" T4 L& }, T$ c3 ^7 V: Swhile (!Finished) WScript.Sleep(2000); 1 o9 E3 M8 q$ e5 |
! K1 O3 O3 V7 F
simple.CloseModel(); 2 k( f# N% `0 m
simple.Quit();
/ D+ c5 b) V# B/ ?WScript.Quit();
" o! a D) |9 ~8 L' L9 {9 W* t
& y8 }* Y: A1 S3 ]$ N3 S - _& U. ^( |% h) S' J' M/ B
function RemoteControl_SimulationFinished() 3 S' s+ d9 S D, D& e U+ ?* F
{ % |( c/ u H5 y! @
WScript.Echo("Simulation Finished!"); |