Example of a JScript
2 P: {: \# M6 ~/ K: Nvar vbOKCancel = 1;
3 i8 ^. X5 o5 F: {var vbCancel = 2; & _# ~; d. k0 z0 B4 M5 K% k
var vbInformation = 64; 4 k0 a. j: E V
var Finished=false;
0 O N* L7 E! E5 ^% p+ z' _ ) ?6 O- h5 V/ E8 z
var WSHShell = new ActiveXObject("WScript.Shell"); ^' A/ q c! S3 K$ g
' O M, E5 @5 P1 [1 W. g* P9 {var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
+ Y8 h! t9 a4 @& K
* f9 b8 J. p9 ksimple.SetLicenseType("Runtime");
3 y5 y# }1 h) `. m' F1 R & P+ Q; x$ X8 q! u- V
try * ^* l/ m7 \; v$ Y- m
{
9 h- t w& k+ _% S- ]. o4 R2 H // Enter the path to a model file! , s1 e5 P$ C0 R4 ?7 C: p. H
simple.LoadModel("C:\\Models\\Test.spp"); & }" Y8 m! V: o0 j
}
: s2 @3 ?( [3 [4 B/ vcatch (e)
" R" c+ C; X6 d2 t{ 8 |$ S9 ^- P: c6 k+ I; V0 |
WScript.Echo("Could not load Model!"); , g$ P8 K- p7 a& ?' `9 F6 ]
WScript.Quit(); ; V( r J8 B& D0 |* q$ c
}
' J E( t, C; z
/ V/ ^3 r( f t& v; ?5 _try 4 P4 g+ {# f1 [; G! ]. O* {0 X
{ , X b1 N, e$ S8 r
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { , \: o. {7 \6 y2 U3 f: S
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); {! L3 G$ J" d. B3 |, w
if (r == vbCancel) # `9 h: T+ t& p! R
{ " E' j3 l3 d# P5 O0 V: T
simple.CloseModel(); # e5 b) v' M; t K7 m+ z! q
WScript.Quit();
/ F+ e; F- P4 k" v5 b7 Z9 A0 d } ) \* Z3 l9 W. [" P* ~# @
}
; W& O5 k* B+ C5 j4 [% O + y$ Y# A6 h; d( n% L
simple.StartSimulation(".Models.Frame.EventController"); # G0 M4 x2 N f, m4 i
' z5 B% O4 y4 S/ }* r5 L2 N
if (simple.IsSimulationRunning())
. f4 G$ B: ]8 ?6 e. T7 A WScript.Echo("Simulation is running!");
" s" E2 @: t3 `# |% R" X; s
6 k' M# } Q8 I+ M6 R1 _// Wait until simulation is finished 7 i; W V% Z* F: @6 E) y2 a5 ~ G
while (!Finished) WScript.Sleep(2000); 3 P% G' r( D+ Q
+ B. ]1 Q9 X s1 J9 e; M
simple.CloseModel();
w; r q8 ?5 K* Wsimple.Quit(); 1 _# K' z. m% B6 T2 N3 c
WScript.Quit();
# D* q1 `/ A3 u& l
2 z H, u+ l: O + F( B4 K, l8 c0 {! _3 N
function RemoteControl_SimulationFinished()
7 J% g# ~/ z0 v G# Y1 T{
4 }! ?. [9 Y5 p WScript.Echo("Simulation Finished!"); |