Example of a JScript . l- ~! y/ _) J& ]+ i: r
var vbOKCancel = 1;
/ v* c3 ]2 k2 v) h; hvar vbCancel = 2;
% G G7 i* u. g" q! y% J2 Q- zvar vbInformation = 64; 5 s! E, M: `, c5 Y
var Finished=false; ( f/ k5 I& V" s( S; v# Y/ [
6 F& o. }/ O) P( v. p* Q: O$ {var WSHShell = new ActiveXObject("WScript.Shell");
6 w) c6 O) ?& o6 s1 n 5 b f* L' T3 F. ]; ]6 \7 P1 T
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
3 H% J& o; N7 x! L; o 8 B6 Q0 K/ { x- d
simple.SetLicenseType("Runtime");
: ~0 q: L/ e: J }# w 0 I8 _1 @% [) t2 @
try
. M g: ~$ {7 g0 z; j{
/ ~7 B2 ^6 n; f& ]8 c // Enter the path to a model file!
5 i! n9 D9 |; o2 a# S4 o simple.LoadModel("C:\\Models\\Test.spp"); % J- |$ @: q& [3 s, E* `, @6 E
} 9 b! `3 d* O+ X/ s/ |% D
catch (e) - J Z* O9 Y4 O, _' {) q
{ ) J2 C' r1 U% H! C
WScript.Echo("Could not load Model!"); + y) q5 X0 q+ K' {9 u4 @0 M) O
WScript.Quit(); 9 x, X9 R: V4 z& Z. U/ k4 c
}
w; `& K5 @. ~
8 B( @* w a) ~/ y# mtry ( U$ f2 k% u0 J0 u7 _2 |" q) |
{ . x0 o# Z; S* Z& m3 @& R) G" ?
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
0 P+ k. _2 p# l/ P r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); % I0 a! M: } Y
if (r == vbCancel)
' w) ?8 ]; o; i) K! n {
' b$ z; U; {9 {+ }3 C( g* v simple.CloseModel(); P6 ]* t( u; ?, K4 L% M& o |
WScript.Quit();
: m. Z: g3 J1 C/ a( }9 ^% s" l4 k } * D# x) Z( o' ]* Z) n5 K
} % H5 F1 o( E. K m n8 S S z J
( F6 I, @6 K7 X# J. j6 a# U( j; Nsimple.StartSimulation(".Models.Frame.EventController");
# H' D( V5 T( V# j, U! J, N 4 ~& ~3 O: y3 z8 Q/ t8 n& W6 z
if (simple.IsSimulationRunning())
2 x' H! A& O8 H$ M WScript.Echo("Simulation is running!");
7 i+ l- p; [# M0 _& \( W5 l " [! S3 o2 H2 z& I
// Wait until simulation is finished / f; n( s: V6 r$ h: ]0 J9 K& R
while (!Finished) WScript.Sleep(2000); * Z1 k4 E1 a9 F) G: v, z
, @6 Y1 i- D$ c+ U# P- K5 B" J
simple.CloseModel();
" t/ b( _ q- E8 {* Esimple.Quit(); 5 r5 k7 |+ s! p; J ]; W
WScript.Quit();
6 ^* _% x/ G( v4 a * a3 f( ?! R/ ]! c
& o" I9 G9 g% I/ hfunction RemoteControl_SimulationFinished()
3 w% d" V9 X, |' k1 e6 b& P{ 7 ?) {9 x+ _) j5 B. ]2 \- ]8 {
WScript.Echo("Simulation Finished!"); |