Example of a JScript - Q" R7 I7 x0 i8 Z1 A g% a8 [; }2 p' l; p
var vbOKCancel = 1; & {3 `( g0 ]+ ^ U# v' Y
var vbCancel = 2;
2 G5 B# z; R, g# t* g, Uvar vbInformation = 64;
& z: H y2 U |/ R2 C/ V4 A8 \ Rvar Finished=false;
9 m( b8 d+ S( e/ {+ g, I 1 L/ D ?0 N: u6 |( l6 |/ N2 _3 a4 @& x
var WSHShell = new ActiveXObject("WScript.Shell");
3 e2 j4 E d; G o$ ]7 _9 C7 s
& p5 c+ g, t8 D. y/ q: avar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); % k- C) y, [' d6 ]7 x( z0 {5 J/ [
- \( ?1 w2 W; U6 H' }: D. F) P0 ?* Nsimple.SetLicenseType("Runtime"); . u; p* l3 S) S8 e- a
; P* `0 n' T7 Y0 Ztry
- ?% b( F/ }; ]( l8 G{ ' c- n9 ]2 ]. y: }8 N
// Enter the path to a model file!
$ p/ }3 ?' S6 D- W simple.LoadModel("C:\\Models\\Test.spp");
5 @" |8 }, U# ]' p c. ~}
; C# s3 q. y) c; h) ~catch (e)
$ E( W6 z+ A/ f; p: T- |{ " z6 b+ e7 g: D' Q. q
WScript.Echo("Could not load Model!"); # U; g/ T5 Y, F" s# @: m5 E
WScript.Quit();
k! t' H: B0 \8 M: u* M, f}
@7 D, C$ T4 ~1 o& g0 {2 Z Q
% d: x6 e1 }; ~( ~try 9 ?4 O5 E* N( w# i2 S7 i* b
{ 5 [4 g0 m0 r8 q6 s2 W" g
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
4 L* u$ K+ d$ c. P2 p% `; j r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
- D; L3 {- O7 P* A1 V if (r == vbCancel) ( o) h' A; g( C, c5 c
{
# Z" N8 B% u1 f simple.CloseModel();
$ z: x6 A2 `+ r. ^ WScript.Quit();
/ d: a, @4 N' r2 |/ B5 T( C }
7 W) g3 c) b; E7 B2 T}
* r5 C# z5 d( E5 a, A) C 3 ]& m- b8 `" ]/ u
simple.StartSimulation(".Models.Frame.EventController"); # }3 G) W: Z) F3 ~! Y, `/ i+ }2 A/ ]; I
/ l* M- F8 ?; S/ {6 I
if (simple.IsSimulationRunning()) 0 Y" l' m8 z6 o$ x _9 X
WScript.Echo("Simulation is running!");
/ `$ i' G j% E6 ^9 H: T. [ % a' V* A4 L" c c% S: Q
// Wait until simulation is finished 1 A/ S; C9 o5 S( n* z$ O
while (!Finished) WScript.Sleep(2000);
; I2 J: Z' A1 F
. @8 n& E. B3 m1 ^ Y" c* {simple.CloseModel(); 5 u3 G, {$ ?( a L( T* S/ l
simple.Quit(); ' _) G' W9 Z) ^: F
WScript.Quit(); / Q! U) C6 d0 ?& B# H( d. W! a: I
9 `4 V1 v' |0 S/ P8 |. n8 C
3 w) s" u7 U- t( o$ z
function RemoteControl_SimulationFinished() 8 H9 L1 r: I0 Z
{ - N- A) p' r5 W' q/ I; I1 _1 v9 T
WScript.Echo("Simulation Finished!"); |