Example of a JScript
0 J* f( U# y# H e; I( svar vbOKCancel = 1; , ?" ]& W) }- e& h
var vbCancel = 2; / z( g. {0 \. ]- x! R
var vbInformation = 64;
" ~! v- c9 J7 K! }% Mvar Finished=false; ) i* T) M" Y9 r
4 P3 I7 u. P0 Z7 h) L$ {
var WSHShell = new ActiveXObject("WScript.Shell"); ]" R! Q0 I) E0 O6 A0 o2 j& C+ ?
* j! F, w( {$ \" Y" C8 }" u, Hvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
) l, O- a2 V0 P S! O
3 [. Y* @: m- P3 k0 v gsimple.SetLicenseType("Runtime"); ' _. k( A+ h6 m% {3 m! L
5 s, K4 Q' g3 w% N8 [try
6 d2 ?3 Z O8 Y, w, u& {! k{ % Z8 }6 W" U H1 w4 d' k( G
// Enter the path to a model file!
* F+ E2 R# i7 @2 c1 h4 ^4 G) c* _ simple.LoadModel("C:\\Models\\Test.spp");
3 x0 g5 c# c+ D3 k' T. c1 m} : J: n E7 V# h- e' H/ m6 v: [- i5 T
catch (e) + M F) y. Y# J% N. Y, J
{ & R+ ^3 v/ v. D! P0 u3 g% a
WScript.Echo("Could not load Model!");
5 S( K# E% v: g) A4 M# F* P3 q4 n WScript.Quit();
# v3 |; X) O4 M}
$ I {9 n) n; I7 _
' D$ l; a" V1 X' f) v" G$ w8 Dtry 2 y0 F& T& @8 ?. v% e/ K
{
6 J) R6 |4 R: W& y+ I. w4 } simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
- Q9 f9 h5 o' f3 h% g6 X r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
6 R% Y+ B& d7 V$ E if (r == vbCancel) : s0 A( `) P! a5 @
{ . |9 ?3 X5 h$ F7 i; {
simple.CloseModel(); 2 z9 w) P6 \1 f7 z- \' _' r& t
WScript.Quit();
) u; B# {9 s o0 i q }
! F. w6 j# @. U" {, e' o- ~}
8 G+ G w& w" f/ w' b
/ B! a/ d9 X) {5 f n$ u8 |2 qsimple.StartSimulation(".Models.Frame.EventController");
. F2 Y# ^1 @; N8 P
* Z6 y! U& s B N+ M, \9 Vif (simple.IsSimulationRunning()) 6 F3 b* z' s% o4 d5 G
WScript.Echo("Simulation is running!"); , {1 e* {. B9 Z! |5 h
$ }! Y7 U2 j0 Q+ i7 K. s1 ?
// Wait until simulation is finished
4 A7 |$ W+ n& m& O( Gwhile (!Finished) WScript.Sleep(2000);
7 o$ k+ r! m" n; m - ?6 s# S* u) [ m5 T" u
simple.CloseModel(); + E8 _* U |! h* E! q6 {+ E: ^
simple.Quit(); 2 Q5 l8 _- E7 e
WScript.Quit();
- I, m. d8 O. c: C P; u, L% [8 q: I. d' Y5 a7 B7 e
3 ^$ z1 d; U q( y) [1 O1 L
function RemoteControl_SimulationFinished()
- F& `) |7 c5 {" }{ - P' T. {/ j# r) t) F4 R- p# |
WScript.Echo("Simulation Finished!"); |