Example of a JScript
6 h% ~8 q, w% T7 m; L3 s" wvar vbOKCancel = 1; / s- X# l. x7 {
var vbCancel = 2;
1 {- R# m: S0 p O" W6 D& Q" |var vbInformation = 64; ( T8 X6 c* v) Y# u. G3 C
var Finished=false; 9 T. m) G( l; [! U
8 t8 Y: c4 R" f( e& ^) ]# G$ H$ X8 C
var WSHShell = new ActiveXObject("WScript.Shell"); 5 M5 |6 S5 Q) ~* Z, O) k
+ ~0 b; F3 a) z. Gvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
5 g3 D+ H. t0 }) ]. O / ~+ V% R9 R0 d! ?. |, o* ^
simple.SetLicenseType("Runtime");
' k1 j1 h3 ]8 e3 o$ }, E% C
! D4 L% I" x$ \) ~1 v+ L/ L. Otry
2 y6 H. a$ E; \2 g+ B{ 2 a. a0 U* c8 f$ R* Q! y) ~* W
// Enter the path to a model file!
$ o8 f8 [# G9 o# ~ P7 c simple.LoadModel("C:\\Models\\Test.spp");
& m9 N# ~( y% h/ S2 ?5 b" S} * m, ?! H# }. Q# Y. A4 r+ u
catch (e) / X! t' g0 F) i8 l/ r
{ ) j5 |( n P+ e
WScript.Echo("Could not load Model!");
$ |5 A/ `! o5 j$ C+ w0 t, j WScript.Quit(); ; Z) j) ]8 B1 N2 D* @
} ' H& l4 D& A& D$ H0 I S
; s" V( d1 f+ m: u$ V
try : q" A2 Q2 W" E# h1 D
{ 2 e# {$ O7 }! K
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
4 ^0 w- D1 N3 j% s9 i+ u, T* X r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
4 i+ }* \. c# ~ if (r == vbCancel)
- d9 b# D5 }& k4 |% L {
0 W( C. C+ r5 Z' S; W$ f0 j& j9 S simple.CloseModel(); 3 v' q% H& d8 n6 n* l
WScript.Quit(); 6 s3 K( K$ T0 d
} 7 N0 Z4 I7 u$ j. i+ K% G0 }. G
}
8 o: S6 D3 ?% i6 Q5 S/ e5 [$ f
, J3 F6 \3 j3 V* ^+ Lsimple.StartSimulation(".Models.Frame.EventController"); 5 y* l, [: v. F1 N! n/ H# F
* Z/ {5 h& c J. W n* i( C
if (simple.IsSimulationRunning()) $ [! J9 p" l4 k' u
WScript.Echo("Simulation is running!");
# O+ P+ q5 n( y' v7 L$ {
G9 t) I5 R( H$ R9 i// Wait until simulation is finished
' Z' c2 n" X8 g" m# Pwhile (!Finished) WScript.Sleep(2000);
4 h; d7 p. N, N& z* r D ; [0 } J7 W( A" k3 N1 @1 {
simple.CloseModel(); ' s; A1 s( B$ M" t* R: m# B
simple.Quit(); 7 B8 g$ h( e; ]+ ~7 A5 u; ]* e1 t2 h
WScript.Quit();
& R" R1 W$ E k; n
) r( U+ m2 B. r* q0 Y8 E
2 B7 X* k8 x$ w$ c. {function RemoteControl_SimulationFinished() ( b, Z$ Y( d2 @+ K
{ 4 n" d7 R# N9 O1 p2 y( Y
WScript.Echo("Simulation Finished!"); |