Example of a JScript * H5 ~+ X7 s q1 J1 F% N5 h- Y: r0 F
var vbOKCancel = 1;
4 t. [) b7 ?2 d& F+ D# b. I3 Rvar vbCancel = 2; - a. Y7 b1 Q v+ ^# h5 x
var vbInformation = 64; 5 N' y& A$ P& l4 K( {
var Finished=false; / r; Z9 N3 p7 n* c0 _2 y* f
( s7 C- [) e, o+ M9 `! n; Yvar WSHShell = new ActiveXObject("WScript.Shell");
6 Y2 X3 Y/ F. o 5 ~: \) B z4 e- W) H' |1 e$ n
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 8 |# B Z3 a, ~* j4 a
! X+ W9 O, E! D, ]/ i# E$ K0 b! z
simple.SetLicenseType("Runtime");
! v, D& S3 K! j- q) H% D4 s3 l 9 o& p5 w+ v1 ]+ Y1 g9 s* R, o; D
try
$ W% Y2 K" V9 F{ . j* ]9 E2 j1 }
// Enter the path to a model file!
. h0 R: h8 ^: Y' t simple.LoadModel("C:\\Models\\Test.spp");
4 y/ m* `% Y3 D: G' r8 }} " i, [, _& Q* U" y6 t
catch (e)
. R7 B0 q5 S* }$ u' E$ E{ $ c# v) E P3 m7 w
WScript.Echo("Could not load Model!"); : v/ n6 o; z* v( ^& U
WScript.Quit(); 7 O% R7 F I% [& w7 \- f9 a7 I
} 9 s: [, M3 W. p0 R9 h* N0 F
- w* m7 K- K" Btry
, E, c( m1 |9 Y{ 8 Y6 B0 g1 v$ r4 D
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 0 O- Z$ `$ ]* X( u2 r5 Q; @- i- ~
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
( z; v. R0 \; u& Q+ o1 z if (r == vbCancel)
$ x$ g" e, F2 {! r4 Z {
( {4 N$ q, o, s" d. t simple.CloseModel(); ( i- N6 g# f8 J; P) @0 O; S" z7 K
WScript.Quit(); ! |6 L, v# C4 {2 I" N
}
# z% `+ V# [6 l5 z* g- A6 ^3 T z}
C0 _# G* p. J9 r6 f. | d
h" ^0 C- F2 _/ e! Y9 Zsimple.StartSimulation(".Models.Frame.EventController");
- _8 }) k5 z% w9 V- K. k- c " S5 ], ?' `- B4 L
if (simple.IsSimulationRunning())
9 z# ^! k. H, [7 f. U WScript.Echo("Simulation is running!");
) E/ e) U- d) K5 \; v7 I 0 E F: D1 j, i5 x$ l- j+ A
// Wait until simulation is finished
7 |$ t1 N, H+ i6 Bwhile (!Finished) WScript.Sleep(2000);
5 |2 Y4 `0 r" \ $ u% x& J1 s; M: j z
simple.CloseModel();
8 _+ }0 g: v1 r, Jsimple.Quit(); ! l! c7 S5 h8 N1 \) y
WScript.Quit();
8 I% x# u3 i( \; ^4 ~
9 ^* q: J: M2 Q 3 V, V1 b5 r' U) x1 o$ p
function RemoteControl_SimulationFinished() % E! r* e7 e2 u7 [- t( l1 B
{
+ T* r w0 Y# g9 c1 h: ~ WScript.Echo("Simulation Finished!"); |