Example of a JScript 0 F& _/ H5 {: V' f
var vbOKCancel = 1; 2 r5 `8 a& ~ d7 t+ ?6 K0 y
var vbCancel = 2; 8 U" J: @) U7 z" i2 x6 |
var vbInformation = 64;
1 Z0 y2 r0 }% K$ S3 R$ ^7 {0 zvar Finished=false;
- v% T- r, P/ L. A0 k5 P
2 Y$ u4 ^0 S4 ]3 i7 x% H' ?, svar WSHShell = new ActiveXObject("WScript.Shell");
( D* S, g8 }9 [; @ ! Z, t; S3 ^3 U. B/ k4 e( p
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 6 q8 w% B f0 a2 {6 @' p& A
* w( R4 C; u2 U! a1 g3 \- K7 {5 Esimple.SetLicenseType("Runtime"); ; M% G, K! p8 N5 @8 U
6 M9 v V! j2 {5 f6 i+ [try
2 v+ R- a0 e6 a/ F$ K{
0 r" D$ Q) R! ~! E // Enter the path to a model file!
$ }" I3 G) C* U- j simple.LoadModel("C:\\Models\\Test.spp"); . o! g+ E; t* d! ~" c
} 9 z: o1 N2 V$ u1 l+ H& F4 N
catch (e) 4 y- }* l6 W; S4 u% X3 g
{ / `+ w& R- c' G; c0 W4 x+ x; `( a
WScript.Echo("Could not load Model!");
' u1 e- L- X! J$ T4 E ^ WScript.Quit(); : m: Q2 \( w$ E
} ( [$ {' M0 q! f- `
" H- ~& U$ o: ]* N
try
# L8 T' m7 j2 }4 u0 K9 D{
( g# g0 R& |; D) D( v simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
, G5 v$ X+ [' S/ R9 @2 A r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
- r! p i( s/ h$ z6 n( F if (r == vbCancel)
2 S1 Q. k3 B4 W {
/ |' }6 g+ |" S3 p: C2 ` simple.CloseModel();
3 r$ @, k0 `! y" z+ ^7 I' X WScript.Quit(); 2 F- h! D1 b1 d# M; |: }5 W5 _
}
0 K" ?' y, Q; l* }" A; l} 9 |$ m3 k" l2 y3 m% J8 T R G& l
9 a7 I9 P3 a) x# i4 t0 ~simple.StartSimulation(".Models.Frame.EventController");
$ J# }: l! O, j# y* z
6 D8 i7 f+ Z: J2 P* nif (simple.IsSimulationRunning())
. a! u; o2 y5 r! ~+ z WScript.Echo("Simulation is running!"); 1 t4 ?3 m3 L( X. O9 D! f
5 }! L+ H6 M0 H0 L* L
// Wait until simulation is finished ) h& L4 f7 Y- I6 P5 P/ y8 H
while (!Finished) WScript.Sleep(2000); 3 S: L2 E; ?$ e
& I, V, [; ~) F- l# I7 _5 m
simple.CloseModel();
5 ~; O0 a1 }; k* X3 qsimple.Quit();
" {: }. w: B' A/ A7 wWScript.Quit();
n" w; }+ C8 W6 e
0 y- {% d5 [# T% e' n
f, E4 h5 Q& V, p+ B$ Cfunction RemoteControl_SimulationFinished() 2 F$ U5 G0 B9 h" X& ~( r8 h a
{ # u) Y# [2 \) Y/ ^+ |
WScript.Echo("Simulation Finished!"); |