Example of a JScript
' R" ~$ U. {, g. [var vbOKCancel = 1; 6 F! ]* F i4 r6 ]9 }3 a2 C, d2 J
var vbCancel = 2;
/ G1 u) Q" `# d3 vvar vbInformation = 64;
0 }( E3 H7 l# Pvar Finished=false; 3 [5 ~$ M- x" {6 S
" i( M8 k: ]) G) y1 Ivar WSHShell = new ActiveXObject("WScript.Shell");
0 @3 e Q. `# t( S 2 G7 ]0 l @2 W3 Z! S& j
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); / R5 k5 Y' B( \2 v8 P' r7 D
2 F, y( ^7 H) {/ B& r; c" ?simple.SetLicenseType("Runtime");
^# G0 p0 s5 }4 g
1 h4 R( `3 Y7 a" O9 q' Stry
6 F6 x5 R' c7 ~9 t# p{
5 s4 y& s% N* V0 I" r // Enter the path to a model file!
6 r, L; \( S/ B7 ]+ I7 I simple.LoadModel("C:\\Models\\Test.spp");
! |/ M* v- n* L1 C8 B}
3 c0 N; v8 ^9 [2 F+ Tcatch (e) 1 C% z) b( P$ T9 e
{
) V5 w% Y; [' n4 o, k WScript.Echo("Could not load Model!"); & W3 \: h& D" x' }. ], @/ ?! U
WScript.Quit(); # Y/ B9 x+ c6 q% i t. b4 v1 E& W
} 3 m" r& P h, k: u9 u( h
6 k3 e q* Y& j8 O0 s
try * I. L6 C) }$ }$ N% a; D
{
' |! B" N2 ]" K2 E+ M simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
9 H/ M6 u1 R- j3 ], g5 J U/ Z% } r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
' _ w( u; t) M5 X if (r == vbCancel) ( `5 l2 Z$ ]& V8 Z1 _
{
! @% A1 s- W8 O4 x simple.CloseModel(); " B2 Q5 i9 w' G/ j) r; a( k
WScript.Quit();
! f5 I& }6 }% g+ |# Q } ) `7 L- n \ Y3 t, k( h
} " O5 d+ W) v! G: }1 {% n2 W
+ J; J# G8 Z# E9 g( I s8 k% Osimple.StartSimulation(".Models.Frame.EventController"); ; M# m5 [; y U
Y9 \3 w2 I) V U. n1 _if (simple.IsSimulationRunning())
N5 L; W: e k8 G1 l, Z5 o- i WScript.Echo("Simulation is running!");
: h1 A& U& ]' T1 X5 a5 g " m+ F7 f! n( H- W/ h, P
// Wait until simulation is finished + h" h4 t: V+ D; o
while (!Finished) WScript.Sleep(2000);
% y- s# o: i: @
8 t8 b0 R2 _* X0 Asimple.CloseModel(); 9 q) t1 a( x; R4 @/ ^ l: u3 N
simple.Quit(); 4 Q5 |2 X( q8 `) N0 N; V
WScript.Quit();
& `/ y C/ L/ b7 O( c- D* m4 A
' g! }6 G- }+ S3 B$ s1 E* R% W6 Y; P7 U
, X( t) v8 X* F" e7 Tfunction RemoteControl_SimulationFinished()
: U% O/ w# b: C+ S9 g. c9 t{
7 X$ c H5 H1 ^; w WScript.Echo("Simulation Finished!"); |