Example of a JScript
4 W6 |) J4 x& G7 b9 _var vbOKCancel = 1; : i6 C1 z& a* k
var vbCancel = 2;
/ q9 N" w' i' ~) \% Z5 y, F, a; Nvar vbInformation = 64; 8 j4 L1 ?) k' z6 H3 j: E
var Finished=false; " G3 w T9 D$ p4 P& D5 J8 [
3 v s3 G. M* ^7 ~var WSHShell = new ActiveXObject("WScript.Shell");
7 s; f: S& C' y1 }
1 I( V2 F T; z7 Z& l6 I- nvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); " @' o8 N2 U; E* ^; U
) W' f8 c% N( Z" T4 [5 G2 m+ b4 Msimple.SetLicenseType("Runtime");
* b# [' A( h, S/ L5 y" \
/ A9 G H! T) }6 U" z& etry . \7 y& x+ T/ f* Q4 N
{ 1 S- z) M* ^. } U/ f
// Enter the path to a model file! 1 x/ n* g6 z, L: L
simple.LoadModel("C:\\Models\\Test.spp");
2 \# U3 q4 J! S}
' A$ a2 ]3 m* x8 R2 g/ J$ ^3 a. Hcatch (e) / a) |+ c6 @- h/ @+ U5 }
{
; x8 H, y- h+ ?: [- K# |6 U, n5 e WScript.Echo("Could not load Model!"); . r% b; }( j8 b Z8 P4 {, e! w
WScript.Quit(); / S& ]! q$ K4 i8 j$ O) ]+ S% A
}
% a- M5 w8 I$ \, y& C" _7 x + y4 T' Z* _$ ^4 n) a
try
# X4 I$ M4 w" y2 d8 d{ - u7 b: E& {- S" p4 t6 n
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { & ]8 M- [$ E) {! z1 P' v
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ) T( G7 ~5 m5 X: P% ~
if (r == vbCancel)
, R, ^7 h9 g7 u {
$ I* \ q, c* t" B r1 O simple.CloseModel();
3 _( k* d5 p; t* ?% X1 Q WScript.Quit();
' u# `( g* G8 D* O }
; N. \- L$ T4 S! R! V% k: F9 x}
9 i9 q+ v: E2 w+ J5 B! ~& X ! Q8 {9 L# x" y' D
simple.StartSimulation(".Models.Frame.EventController"); : g/ k5 O: [" @0 N4 P( y9 f( P
5 q2 l! `" n. v6 f: ] {
if (simple.IsSimulationRunning()) ! l, z# E. M2 E3 ?5 q3 {
WScript.Echo("Simulation is running!");
* o' X1 O# @- F& W- n+ _. p # I3 c/ { Q. c0 q% m; ^% b
// Wait until simulation is finished
- q7 e( y4 j, s! t/ ~9 Q7 O+ Ewhile (!Finished) WScript.Sleep(2000); ) z5 I1 q- B& s, d' c7 L
& W5 X0 H. \$ i- b" U2 f/ b% n
simple.CloseModel();
; [ J& O* o4 ]+ W! Asimple.Quit(); $ |# v( |% p, U$ L' d/ j |; C0 G
WScript.Quit();
3 [! w3 A* ?/ b; A5 c; u C {( c : {2 p6 h; ?6 B U
% O3 ^% m) h: s! W6 T6 {
function RemoteControl_SimulationFinished() 0 E3 ]5 G" h4 U
{ v, `- Q& q1 g: F; L
WScript.Echo("Simulation Finished!"); |