Example of a JScript
* {; x8 J8 D1 e5 Svar vbOKCancel = 1; % U+ x2 s' F9 k `( E- o3 E) ?9 x
var vbCancel = 2; , T# h. V$ ~- b/ Y/ ]# E
var vbInformation = 64; ' g% ^3 Q+ a/ T. d& r9 N6 t' r
var Finished=false;
( D4 ~; o$ k5 F( P 8 J+ }$ p) D& [' T
var WSHShell = new ActiveXObject("WScript.Shell");
/ y5 y2 N' J- J # u8 C3 R; @+ d( C/ X* Z+ o3 o
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); % `5 B* s9 \3 S6 ]/ k. i
, A# p) j5 G6 h$ C
simple.SetLicenseType("Runtime");
" j! |1 f6 ]4 L6 x: C' Q * ]7 x: s, W0 i1 i; R2 s8 k/ r7 m
try
1 w4 p! [+ j% f* h{
6 z2 S" ]( s5 N6 O // Enter the path to a model file! & d6 e$ @7 B. p+ ^5 ~$ M6 S9 i
simple.LoadModel("C:\\Models\\Test.spp");
+ Q0 j5 `+ X- t} 9 y3 a) L; D/ p; c
catch (e)
& l3 ?8 W0 B( P# l% A1 m* S{
C& U* L) L6 ^& V& Z WScript.Echo("Could not load Model!"); ) }, U y; A7 g M. A' g; v3 G4 {; [
WScript.Quit(); + @$ @ W9 l- E8 b# G( x# I
} - K* K8 d! V0 m2 ^
; t7 s& u* D& q+ V2 m1 C) C4 ptry , w( M" U7 E l( d5 v' h
{
* j3 R, E- V9 } simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 0 R; Z$ f) R {1 D( T' D r( w2 U3 |
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
H+ |. h" Q8 R$ t if (r == vbCancel) C3 u) D) b* W: E
{
% j( S* t+ W& I simple.CloseModel();
/ z" n. {& d4 V1 h& ?9 @ l% _5 `! o WScript.Quit();
+ x8 s4 t" D8 C1 c& l+ l+ i } : [. f! s/ H# A. i0 X
} 2 A4 X$ O1 ?1 N) V) \
. ]9 O% m6 Y" H* P R. f6 h/ j
simple.StartSimulation(".Models.Frame.EventController");
2 Q+ n5 r0 e& d. s9 U. l : o$ ? |) x- ^( S0 I# Z
if (simple.IsSimulationRunning()) % k$ N0 G& P5 p2 P$ y% A
WScript.Echo("Simulation is running!");
9 n7 S! d& L. j* b* Z
* }& e- x, h: v/ J& w j// Wait until simulation is finished ) z. y, G1 m c5 s3 e
while (!Finished) WScript.Sleep(2000); % R6 s7 u; C, s! V# A. ?. h
1 X. @/ \" w' rsimple.CloseModel(); 8 e! E$ H( B5 q" `
simple.Quit(); b$ ~8 V2 `1 F
WScript.Quit();
/ [# _+ p0 p0 s7 h9 k: v7 G 4 [. ~- Y5 o& k! B0 e% C" ]. z
9 T/ m( g4 j L2 T# u1 f X: Pfunction RemoteControl_SimulationFinished()
" ]5 B; |, }: a$ K$ P{ ( t4 @; ^6 }* a* L
WScript.Echo("Simulation Finished!"); |