Example of a JScript
1 g# d: a; \6 U/ c* W+ @9 Ivar vbOKCancel = 1; # m' R+ I* l- S) m) c4 o
var vbCancel = 2;
$ l. V+ s) w9 hvar vbInformation = 64;
3 X& F' y e5 d2 q3 Xvar Finished=false; . G# m* z6 V. O! k/ F) I6 a& G
% U" E' z+ D1 v# a% jvar WSHShell = new ActiveXObject("WScript.Shell");
. {4 }* w4 q4 z J+ G - ~# t$ d5 U$ ~8 z7 n/ d, W
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); # S0 W' a7 W' [5 h$ V- M
. p0 z) K n9 L3 l9 ?' p
simple.SetLicenseType("Runtime");
1 ~: v- E2 k- Z! w3 [" A2 ^
. O9 ^+ X2 q3 @7 itry " g4 H% O D9 h
{ 8 P( C. N" k8 \- w* I* Z/ \
// Enter the path to a model file!
9 p6 E/ [ a' H$ i simple.LoadModel("C:\\Models\\Test.spp");
9 b1 {! I5 Y( f5 @# ^4 \# O} " {& c& T- V! q9 T. n( k$ h4 ?) o
catch (e)
) Y* O/ y0 S/ u- c" m{
$ a$ A4 n4 {" i! c, H# x WScript.Echo("Could not load Model!");
5 l% r' w9 w: ~ WScript.Quit(); 6 F2 b0 a: m2 r8 A
} G2 u8 M) |5 N5 h' I0 d5 `9 z
7 v2 s& o$ o" _1 H) S) G# Z
try . F3 `2 T& L) E% ?/ Q
{ ( W8 M3 s6 u2 I# t6 r
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
$ w. C& a7 ]' B r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
P2 I4 A' ^5 v8 [$ f- r- m if (r == vbCancel)
4 C' `5 g# z( l1 C0 W. w7 w( {5 b {
0 A; L* a; D- q8 \/ m simple.CloseModel(); + V+ Y. v6 B6 e/ I+ t4 W. V
WScript.Quit();
. s0 X0 p- ~6 C2 t/ ~& b# h } 7 p9 i2 F1 Y( _- u- O
}
7 f+ n- y- ?3 i z; m7 a, g4 H$ P
& L6 c9 O# @, J5 A! h6 C' psimple.StartSimulation(".Models.Frame.EventController");
6 W$ v8 A8 z/ j
; i6 M! L& M7 e9 u, \9 w+ s/ Rif (simple.IsSimulationRunning()) 4 O3 Q" n3 K+ L5 c
WScript.Echo("Simulation is running!"); 0 a% t9 C+ ?: F/ u6 f
) H6 Z. l4 ?) e8 o: Q Z
// Wait until simulation is finished & H# u9 h8 u D
while (!Finished) WScript.Sleep(2000); # l: j r) e. x! O- c
; v9 y3 C% T4 U" \- Ssimple.CloseModel();
$ f L: }% v1 Ssimple.Quit();
3 |, Z. H6 E1 ^9 h8 ^% t. x bWScript.Quit();
4 J0 K% R7 `$ b9 h+ x% A
. l) a+ e$ J _ s. m' r# m" O8 `
) E+ L/ f# B( A# i6 {. ]function RemoteControl_SimulationFinished()
) ]* x$ t5 t w. j) I) o! N{
' ?% Q# q( z- h5 t/ s- Y) I WScript.Echo("Simulation Finished!"); |