Example of a JScript # l! q4 j" t& w4 V" m8 @0 X/ ]
var vbOKCancel = 1; 1 ~% _2 \2 V( ?0 g. P( `
var vbCancel = 2; 0 y! V: v. K2 F" f# H5 x
var vbInformation = 64;
# y( n# S5 D( Q7 I% ]var Finished=false;
4 m% f: O4 P4 F% W( _* Q, F
( l0 H& u+ K1 cvar WSHShell = new ActiveXObject("WScript.Shell");
6 a* M/ K9 G, z8 B* { c, ~ ) O! s& @7 X' _" ^- f, r
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); : W8 E' l% i6 k- l& f) n. V' a3 z' p
+ t/ W" g! }; d0 vsimple.SetLicenseType("Runtime");
3 F3 [1 [' M @ - G) g" E3 m, p, j: Q' M% w) q1 b; X
try " \& ~! q: j0 L) \5 N$ N/ P
{
0 @7 Y5 h6 w/ c) c // Enter the path to a model file! ( J1 \1 c6 T) y( J; a }% O" A
simple.LoadModel("C:\\Models\\Test.spp"); 4 n! {. W: P1 Q
} 8 A: V" H0 E3 X: k
catch (e)
( C0 i) o7 A( E3 Q& _{ , x1 U) \% \+ l* o8 [6 O! b
WScript.Echo("Could not load Model!");
" O& C6 [( A4 h WScript.Quit(); " p" b0 V3 p! u8 R- W9 q# y
}
% |' C$ r4 `0 ^% k, s# } : L0 k0 D0 S8 H- n" m0 W
try , G% X8 S/ F0 Q* Q! p
{
( |6 J2 C* D( Q simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { # N' Q3 w- @! y* ^, Y
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); $ c0 p& M n: m; R0 m2 B
if (r == vbCancel)
9 R& f7 q, b% R: X3 `$ R) H {
, R( x( c' w) Z% v/ C- a" R simple.CloseModel(); - L( Z- i3 Y5 d& H- `5 ~' H
WScript.Quit(); 7 @4 e a3 u/ O+ ?
}
$ ^3 w9 L3 p: ?$ ~2 B} 7 U' @$ D$ A J7 ?; B4 r" `
% s3 L7 O2 q- O7 @3 x( A6 c* p) Rsimple.StartSimulation(".Models.Frame.EventController");
. D4 f/ Q {2 J# ^. u . `+ d# F0 l' Z9 x
if (simple.IsSimulationRunning()) ) V1 J; D* Q6 y0 i; _4 Z
WScript.Echo("Simulation is running!"); ! @6 t' P, e+ M+ M& i+ d' a0 k
$ b- Y/ K4 i7 H% q( J// Wait until simulation is finished # v3 ~5 p$ q m3 i
while (!Finished) WScript.Sleep(2000);
* k4 u( i- k. r4 d5 Z, Q
. f# W H2 v& {$ U V& b, isimple.CloseModel();
8 _* v" ~4 y0 o, K4 A# M6 ?# a2 D# |1 c4 msimple.Quit(); 3 G5 Z7 j0 w& S" q4 e" N. m2 @1 F
WScript.Quit();
& ~) m9 P% D5 d1 k: L3 j: x 0 T+ A5 q$ K1 @# R9 P- A& ^! o
+ `) V% i8 [& X5 ?8 \. L( i- h
function RemoteControl_SimulationFinished() 8 t1 x( r* _) o
{ 1 b# V9 R# P+ D
WScript.Echo("Simulation Finished!"); |