Example of a JScript
2 Z& M/ V7 j [" {5 U. W0 @( d$ cvar vbOKCancel = 1;
( C* V7 s% V# z9 y5 Xvar vbCancel = 2; 0 d# q+ b7 v- m
var vbInformation = 64; ( x9 A. |% w; h1 |9 p
var Finished=false;
2 V& U/ U+ y$ }7 R% e& w3 } `- A& y& Q3 H; m* O/ a3 b
var WSHShell = new ActiveXObject("WScript.Shell");
. f! u S3 }3 G @- K
4 d. M+ v: I- Pvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
/ w I4 e2 c1 b" n" n
) s9 j) K) t; \; y' V/ Q2 Z4 Asimple.SetLicenseType("Runtime");
5 H$ O* i. U* q% [ * N2 v+ D" N4 {; S, J1 b/ ^$ d
try
! {* ]" s8 |) w/ w{
" x3 ^' X* V% @) A) q, i9 z |( G // Enter the path to a model file! ' P# ^/ b: l0 L7 s0 k
simple.LoadModel("C:\\Models\\Test.spp");
$ r2 @1 o% F7 t$ z7 n9 c}
2 ]- x( T) T% |, Jcatch (e)
$ q+ ?# @5 x4 P: D{
7 j9 g: b3 H) T7 k: u- J2 D* w, n WScript.Echo("Could not load Model!"); $ y6 Y3 h! }- \$ \
WScript.Quit(); 0 Z$ B7 c% L$ D/ e
} : O0 k% u) \; g$ M+ l6 U: Y
& l0 m1 F2 K8 U1 Z( _
try ( M! @7 Y' S; F5 m1 l2 w
{ $ u5 j& H. O$ \7 A1 q) y* r- L. O4 z
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
! r; F/ Z7 x4 H; P o' @ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
+ D9 e; k* }& X7 U& e if (r == vbCancel)
# F2 J9 n5 V& @' J, j' Y6 T {
5 `9 u0 b( _7 [5 h! Z simple.CloseModel();
) S; Z+ m7 h) [ o2 o' | WScript.Quit(); ( ]* r. R( h# w3 q& c1 P( C/ o
}
, Y2 e2 b T+ z/ i& G5 k) H A}
( e c! c$ a, m, x; t9 K 8 c, C+ |0 y6 m1 ^1 d& {3 a
simple.StartSimulation(".Models.Frame.EventController"); 1 B9 D Y$ i7 K: `# ]
$ Z/ g9 H9 {" j
if (simple.IsSimulationRunning())
6 F: j4 F! r5 P, T WScript.Echo("Simulation is running!"); , n& ?! H% q9 t+ g8 e' G$ Q( Q
2 ^( u* k, m b2 Q7 B
// Wait until simulation is finished
2 p! [, S5 D# Xwhile (!Finished) WScript.Sleep(2000);
2 W/ P+ h4 Q) k1 l5 d( C0 p, E + h# a+ k$ I5 @2 G1 `) w1 r
simple.CloseModel(); 5 |5 ~& P. m9 U/ ~" @
simple.Quit();
, {# q7 e+ w0 YWScript.Quit();
7 ~" E8 g/ t/ X
$ P! W" R1 I3 J' I; n, {% L; z 2 V! G2 M7 s9 h; Z- f
function RemoteControl_SimulationFinished()
) B) z6 z& W4 U$ x8 [) J, g{
4 ^7 r( y; R. e WScript.Echo("Simulation Finished!"); |