Example of a JScript : ^9 Q# Q- I8 z; p- `, g5 E
var vbOKCancel = 1; b6 \, d8 [, R2 R
var vbCancel = 2; G3 J( I" h% x+ J
var vbInformation = 64;
- v& z& e( K" u* l( ^7 `' Yvar Finished=false; 4 y1 H) } f9 a) |9 N W
3 g4 Y n# v7 h' w1 L. I
var WSHShell = new ActiveXObject("WScript.Shell");
: E3 f- E. A/ n* F7 E0 n + J% V; P3 F; t' i7 |' [
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 3 k6 C2 J" L& J; F/ n9 S: U; N
: }0 p& A; k4 W$ n, `* { K6 V" }0 i& ]simple.SetLicenseType("Runtime"); % P/ _: |/ [8 u! q: C: ~. r7 S) Q
3 Y4 C$ Q6 m% G4 S" S9 y
try - a$ j# K# f1 I' A2 n: m
{
/ ], S8 a: c7 D( ?. j' ^; V4 R // Enter the path to a model file!
6 w& n) \7 N9 W& n simple.LoadModel("C:\\Models\\Test.spp"); 5 N: F3 [: b$ o% F; w7 D$ G
}
6 @9 C L/ g9 D6 x) k# d9 ccatch (e) * m+ x0 \0 f, l" k8 k7 z" @- h
{ 9 `( H% O+ @0 W7 z/ C
WScript.Echo("Could not load Model!"); ( Q Z( ]6 R5 L& I: n
WScript.Quit(); % W& W7 d, s# H0 l( A: {( E
}
- t$ Q7 j- L# E* L! j % m+ D* V/ w- h3 m0 I6 U
try
' j+ V, M3 Z( Z6 ]{
/ \/ s1 F3 P; u simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { & I ~3 ^# G/ K; d- ~# p1 F
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
% Z& J, D- I9 m6 b if (r == vbCancel)
2 T$ {" g B7 E- H5 z3 t {
& R% n& ?+ }/ [! } simple.CloseModel();
' }3 t8 C0 l7 l; j7 G WScript.Quit();
& k" M0 k' j0 H$ J/ i% ?9 J6 N L1 t5 [ } ! s; l. \" c2 n! h
} * |/ h+ n5 ^5 f$ |2 d
$ [; L" V1 }- Z+ [simple.StartSimulation(".Models.Frame.EventController");
Y# a P. o- R9 j: v9 Y8 Z* q
/ I6 |* Y' S3 U, nif (simple.IsSimulationRunning())
* B+ y5 {9 g8 P: Q WScript.Echo("Simulation is running!"); ! N5 }% Z, W' i% c/ F2 ~
4 G0 i+ l4 @9 w9 U, j3 c! D) z
// Wait until simulation is finished 2 G6 G2 U" J, k' ]0 R
while (!Finished) WScript.Sleep(2000);
, d9 u6 M, l5 ?, h: J1 e + x7 Q1 f; s7 X Z' O, |
simple.CloseModel();
7 o0 I1 @, S# y$ s& Z- n9 jsimple.Quit();
; R! A( i2 g& l. g3 x9 OWScript.Quit();
. h2 b, R" n) t4 [, c0 r: x9 ^
: u$ g0 l2 Y$ Y: W4 W
: L c d' R+ C& U/ }function RemoteControl_SimulationFinished()
}: R7 S- ^7 B1 r{ ; z$ y! d4 X0 @3 C, O; G d/ |
WScript.Echo("Simulation Finished!"); |