Example of a JScript
8 J/ P$ _: a) ?* Tvar vbOKCancel = 1; - V e' F% m" {, I+ j4 W$ W
var vbCancel = 2; ; M; P8 @4 E+ y2 z4 `$ m8 N
var vbInformation = 64;
+ D$ L! _4 g2 f0 C; }1 {var Finished=false; ! X7 M5 D: c' q
. Q5 B: B! d* Pvar WSHShell = new ActiveXObject("WScript.Shell");
: j$ i }. F1 C5 u1 T % I/ A1 |: F0 ?9 e0 c6 N" s
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) p) b; ^) p# P9 c! R0 j* c+ Z* f& p
" V }7 Z! z {0 m+ `5 u5 V; W! asimple.SetLicenseType("Runtime");
$ e; T! ?5 y% ]7 a# m& G6 J# t
* W5 f1 e1 k! c" N1 Btry
8 n! T+ [, Y3 T: K5 e9 D{ - o$ E% |" k! _7 O
// Enter the path to a model file!
+ g) `5 v& G5 J/ N; U simple.LoadModel("C:\\Models\\Test.spp");
( h! a; D$ x S) U1 m' V}
" M9 p- T, G) x# w" M! h; gcatch (e) * g6 ~ I* e4 m
{ . Y& n- ]: d0 g7 Z+ G
WScript.Echo("Could not load Model!");
+ H+ I# r, Q0 B WScript.Quit(); * V: k- B ?7 V7 _8 j
} # T6 X+ W1 h' s5 `& W
3 G2 I) g* D/ R) y
try 8 z7 x8 P; g/ w5 P: [6 Q
{
+ x* I- F7 q( N8 w simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { , R, A; S" _7 O. \2 U
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ; ?8 B& ]& o5 v# r
if (r == vbCancel)
; b ~; d% P' Y1 F+ O { 0 p( C/ e. T! d# k4 M
simple.CloseModel();
* Z5 Z7 `6 t' w- f' Z8 d9 S: [3 p6 x/ W WScript.Quit();
' T1 k8 x( X' \6 b, | c) } }
; d7 H* j: O- Y" l6 N}
6 z9 {- \! _: l) }( W
* @3 L- R# X6 A) Z! p7 v* D' C" Wsimple.StartSimulation(".Models.Frame.EventController");
3 }) A- R j* }" a1 j+ l# p
/ H# r0 N8 v5 W" k4 Sif (simple.IsSimulationRunning())
9 k$ a$ T: F. u WScript.Echo("Simulation is running!"); & ]. r( D! U3 V) z1 v! s+ `$ I5 P
/ ]: b9 l* e+ ~' ?7 A// Wait until simulation is finished
6 s, M; R% |3 wwhile (!Finished) WScript.Sleep(2000);
; a8 K3 G+ h. t j0 \% F, q
0 \- g7 b' a. t: b/ `) h) k8 n e- A }1 Jsimple.CloseModel();
3 `% A+ G! q+ f( Nsimple.Quit(); + K# G; g1 g- w" |# `
WScript.Quit();
4 G% U; ~. H3 p/ A/ l 3 L4 e+ Z8 h/ T: \/ _
7 S3 c" Y7 G- w* W3 a# U; \2 n( j
function RemoteControl_SimulationFinished() 8 p* h" V6 n/ v3 Y; b
{
: w& I) F: F- r WScript.Echo("Simulation Finished!"); |