Example of a JScript
5 _0 Q/ T! f3 j/ P9 h& Y( Uvar vbOKCancel = 1;
8 Y9 |# @2 K7 @& p/ nvar vbCancel = 2;
' K3 e* ]) I, Z4 p, ^! vvar vbInformation = 64;
& j# c% ^* }% S; b4 P; f3 K% lvar Finished=false;
- h; a( m: H' x0 d4 v7 v/ y1 ] Z8 g, \
: d F& y( s* U0 H4 ]9 Kvar WSHShell = new ActiveXObject("WScript.Shell"); 4 q8 b- i/ B% }6 l( }
$ o H: `' [) Y
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); W! ]& i, I, B; F! c4 s
5 X- I, _8 e G, y8 g" y; Q& ^$ Fsimple.SetLicenseType("Runtime"); . r5 j- p# U+ }$ h- N, t
8 s! g8 l. A4 J* y- k- ?
try
+ l, p, ~: i( d/ p7 e& d0 x{ + S. V& C* y, M7 p6 o
// Enter the path to a model file! " d" E. M2 `/ I+ E; F
simple.LoadModel("C:\\Models\\Test.spp"); ' b6 ]; u. b/ X- w7 {1 \* {
} 8 m) g# n9 E8 z' `! |( `
catch (e) / D4 W/ |9 r( e! ~! ?* m0 T
{
0 T" l1 \' ^0 W0 B: S; g2 K9 ] @/ ^ WScript.Echo("Could not load Model!"); * D, \# O6 N5 p1 w- t
WScript.Quit(); 0 w# D4 S9 l- R" Z
} 4 f6 @' Z4 B. R' f0 M5 q
! Q4 _+ b- c4 Otry
# T) _# T2 K A2 u/ W) i6 l/ x9 d3 P{
# y5 G" |; B+ z5 L2 a& c4 | simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { $ u5 g% y) H) w( |" C, L
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 2 |" k3 e3 M: H9 E8 u
if (r == vbCancel)
8 N/ e- m1 {2 m2 {( Q9 R {
) K6 T6 ~3 I) r% u" ?, a2 ^. _2 B simple.CloseModel(); $ B7 L, o# H9 T( \
WScript.Quit(); % r _; D9 Q3 R) d4 N& B
}
5 O) V I2 h- Q# n# f}
: M ?: X9 Z" J
$ C) u# Y) ]2 a8 J$ j% }6 [simple.StartSimulation(".Models.Frame.EventController");
. U) H- q: u+ q5 X8 ~
$ o) Y7 Q6 C! x$ K" D4 I/ @if (simple.IsSimulationRunning())
5 \$ y0 G3 I6 T4 Q* C WScript.Echo("Simulation is running!"); 2 f/ [8 s) s! E _ T. q
* l5 L( B! S U
// Wait until simulation is finished 8 h8 N2 m/ B2 D7 u. z2 `3 l. R8 |
while (!Finished) WScript.Sleep(2000); # \+ c# K" p$ U, G
4 j0 W8 @1 m& t" \$ w# z
simple.CloseModel(); # d5 F6 b& Q) H- v. C( W2 H& ?
simple.Quit(); 5 r! p6 H3 v8 N/ a* P4 r% j
WScript.Quit(); 4 n0 r0 B) x n$ ^5 E4 h% o
( N% W' N" U8 Q0 c$ d% K6 N0 ]" O* e
8 N% d% F( }' F1 x$ q* J5 Wfunction RemoteControl_SimulationFinished()
. e9 h! \, j! l/ [* a{ # Q: E, ~7 M S9 P& `
WScript.Echo("Simulation Finished!"); |