Example of a JScript
' @; F3 D+ m4 h9 M& [1 {1 E' {2 F# ivar vbOKCancel = 1; Y3 j* Y; P# g1 n* D" d
var vbCancel = 2; 6 D8 n1 s, T: [; U' M8 ]
var vbInformation = 64; - G( z+ S+ U8 Y3 S- Q
var Finished=false;
. _$ n/ J5 x# O
4 R# z( x, n% Q! d& B' {- D' k3 kvar WSHShell = new ActiveXObject("WScript.Shell"); 3 U6 W! X/ Y: B
" A- s4 l+ e; c& {5 ? F* ^var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; A: [! ~+ T" T8 P; k 7 q7 S8 {$ t, t8 i5 w% Y ~8 x
simple.SetLicenseType("Runtime"); / X( { S7 M3 \5 g% u) V
) y' b" Y# B* ?: U. Vtry
5 |7 _# f1 x5 n* T) x{ 2 z' E3 B% p, C5 n; U; ~) A
// Enter the path to a model file! ; i8 s# c" t: }. w
simple.LoadModel("C:\\Models\\Test.spp");
* Q' U7 Q+ l& H% i; M D* M. T}
) L, i$ C% J' u( ^% r. M# o" {+ A* Jcatch (e)
8 J% w5 ?# L: A; A4 i3 ^/ x{ u) V# y3 I, \( V5 a' L
WScript.Echo("Could not load Model!");
4 V y) y- p+ i( [$ T4 t( ~ WScript.Quit();
# ?' h, i( r6 R: L} ) G" y3 @ g6 M
( T, p- ?0 Q# q. E/ L1 A
try
! d* ^0 V8 c, G8 ]( C{
4 b2 k) S- |6 A( n# X! A simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { & N$ J [4 S* m7 z
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ' d+ P0 p! Q* F, o- c
if (r == vbCancel)
5 Y6 `. z( r: V& I1 W) U% S {
6 G" B6 C4 f7 l1 V8 w2 g simple.CloseModel(); 9 }) m! x. ~5 ?; N8 Y4 X
WScript.Quit(); ( ~* I( n# `2 d, T! K
}
1 n! f: t2 h g1 m1 @: r0 [# f} 2 w& X4 b$ [7 }/ _/ |
4 R% Z$ o. W% y' Z9 {# isimple.StartSimulation(".Models.Frame.EventController");
3 k, n. K4 r$ o0 Z1 [/ B { # `- V; t+ W3 q3 {- d
if (simple.IsSimulationRunning()) 2 i9 R3 B' A8 G& s6 \# u
WScript.Echo("Simulation is running!"); 6 ~& n( ?) A; F8 g& |- O
2 z( o2 {& e2 m9 A: s
// Wait until simulation is finished
3 n1 O/ O# P0 i N1 S' p5 F1 ~while (!Finished) WScript.Sleep(2000);
5 [( q% Q9 Q/ {7 D
- h [: V) K% {6 [. D6 k5 Esimple.CloseModel();
# C* b8 p6 X: i9 i; Ysimple.Quit();
9 k1 Y! ^$ o; k# S' TWScript.Quit();
j; H- n5 |- o2 P; Y' Q / [1 c" |& r* v9 p4 y: m) \% X
/ V% |" y( A1 xfunction RemoteControl_SimulationFinished()
6 E+ ^$ M3 o( O% B& O H{
9 F( \ n& _6 b$ X7 U' \ c L WScript.Echo("Simulation Finished!"); |