Example of a JScript ) G1 q# G% t, |, A5 k
var vbOKCancel = 1;
- R% R1 H. Y" E( [6 Bvar vbCancel = 2; $ B# L1 T( {! Q" Y) u
var vbInformation = 64;
; @* L3 k, h. Z2 }8 c Zvar Finished=false;
2 O: ~2 @) J. Y: G2 Z
; ?9 S5 ]5 t+ d( b& svar WSHShell = new ActiveXObject("WScript.Shell");
7 O% O, H; g+ [8 d4 [( S- v2 x9 M% Z 1 f/ j) E& f( b2 }- o
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
V. ?+ v5 ~4 ~$ r | 5 y5 E2 l! [4 y- E* U: S% Y
simple.SetLicenseType("Runtime");
# P. R# ~& ]4 @4 A% Z
: i6 i7 h, h. G0 X9 Xtry # C0 Q4 P) G6 l+ Y ~
{
4 [) p: O) _/ I // Enter the path to a model file!
& X) e+ o9 P1 K& L+ E simple.LoadModel("C:\\Models\\Test.spp");
3 \5 Y8 J, W7 H f5 W; j6 ]} & o+ p& N1 X# q$ \8 {. R
catch (e)
1 N$ k5 {: F9 D7 A0 w3 n{ " i& }0 P1 e% E% X7 K9 v% }$ @
WScript.Echo("Could not load Model!"); 5 Z2 `+ G2 `2 P3 C3 \: O" R# h" S
WScript.Quit();
" o/ T% Y3 _& t" V% ^" p+ M- s} h+ X( r( {7 j- j( B
' R: U1 G8 q9 ?! gtry
; R/ [8 N( _9 L6 W, Z1 y! R{ # r6 `( ^+ F1 [ y
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { $ Q1 x: G3 ?' D' R
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 6 J$ A/ `5 a u' N1 t& b; G; F: v
if (r == vbCancel) ) n6 @( c- J. `) C( r* y6 d9 D
{
5 _5 @5 c5 p" H' N7 Z& j5 X* B simple.CloseModel();
" W2 R+ O) c2 {2 J WScript.Quit(); 2 `) P; e) p7 Q7 w7 P9 s% d
} 7 ]" W! j# `# d8 t4 D
} $ B5 x4 M5 N) o9 b3 {% a
1 {' s( {: A! G' L6 Q( H/ f+ Csimple.StartSimulation(".Models.Frame.EventController");
8 f3 {9 M* D8 L. G2 J4 \. S- o8 s
/ s( `+ J3 w2 [, fif (simple.IsSimulationRunning()) 7 H4 T* w. q$ {4 Y9 u8 J
WScript.Echo("Simulation is running!");
6 y. z. [. ?% Q9 m0 E
6 @. c9 ~3 s9 x// Wait until simulation is finished # A3 U- o- W" g. X% {
while (!Finished) WScript.Sleep(2000); ( I/ |2 u$ N+ I4 b! l$ {) r& E
) n) j" p6 Z: p0 A- S8 A z: s" S
simple.CloseModel();
& h; ]' s9 p# @3 o% }4 Vsimple.Quit();
, f7 G- {6 @( _% ~# l# LWScript.Quit();
; p: Q' A' Q& X! p 1 K3 l( t6 `( B, }+ |! r. z
* D, M Z# K) A- Z8 Sfunction RemoteControl_SimulationFinished() ; F7 `: P+ ~) H
{ 1 J/ ^! y; x0 m, n$ c8 ~; f% Y, K
WScript.Echo("Simulation Finished!"); |