Example of a JScript
; u H9 W) |. k4 P6 Bvar vbOKCancel = 1;
% x& a5 K4 Z( b, K) a7 _var vbCancel = 2; 2 E8 J9 F6 H+ A$ s+ Z3 t5 p6 l
var vbInformation = 64; ) Z/ j# j- L6 W2 {3 R
var Finished=false;
' }* ?/ D, _ b3 K" O9 U9 _0 ?4 l, a # h: {: O! f- d
var WSHShell = new ActiveXObject("WScript.Shell");
; K+ y* v& E3 c; B" l4 R/ g8 g
5 c) W8 f5 `6 `$ k' Dvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
' W! |8 K4 ^* n) l+ ~
; L6 k, N: c0 F, c# |1 l/ _simple.SetLicenseType("Runtime");
! t5 t! q0 T1 d U , E* A: B- k: L% {5 [
try
( |# M4 z1 r: Q$ Y{
' U H! p- j; }, s ?, _, T9 T // Enter the path to a model file! 0 j/ O4 n1 N! W% j' m9 X
simple.LoadModel("C:\\Models\\Test.spp");
1 \9 h2 p& `3 s* x0 l; p% q' W1 T} ' U _' F7 K1 n6 S" H
catch (e) 5 G- T/ n, m, Z# h
{
6 q# X. M! G* X! Q& v WScript.Echo("Could not load Model!");
% A1 D& O0 A2 E3 e1 B WScript.Quit(); 2 k* i; x ?) i7 ?
} 5 r9 {& W: W9 P. f. h
1 T# S' U2 t: I N3 } Y" c! V V
try
: ^$ a( V. L' y5 ]5 B. D{
+ Y, \; X, Q# S# g6 K simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ' B& N3 o5 c* p2 q6 L+ C# q
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 8 t. ^9 w9 B# b
if (r == vbCancel) ( s; I O. `; c
{ ) k4 R5 Y1 Z. ?
simple.CloseModel(); 7 u. B0 d( f! {1 S/ Q
WScript.Quit();
7 F; F0 U! R% O) D }
5 Z) h6 @0 c$ p! V5 r! K2 G}
7 f! m" I( u1 w* l# q, b: _" s
; K. K+ J; M3 c' V( r$ ssimple.StartSimulation(".Models.Frame.EventController");
( R5 N- w' C9 o. ]
" `1 G) s. O8 {/ f. A8 v- M: eif (simple.IsSimulationRunning()) - z6 _: `4 E' c% Y1 T
WScript.Echo("Simulation is running!");
) A7 \6 s6 C# Z, t/ f
! H! Q9 x+ X% ~& e// Wait until simulation is finished 8 c& ^" i; k) I3 P8 {- e
while (!Finished) WScript.Sleep(2000); + W* Y' F; }& w' ^1 ^
% e& H5 v2 h- I2 d; dsimple.CloseModel(); " w T1 M+ R4 c5 ]
simple.Quit(); 1 h: b( M" \9 z; a& B/ x- G2 o
WScript.Quit();
2 M u! B) Y. H; @" X$ b; d
}3 B" g( k Z/ o" b6 q
3 K I3 F2 J' L6 Xfunction RemoteControl_SimulationFinished()
5 @- O* O( {2 }6 r k9 r8 K/ h{
3 Z7 O9 ` W; K; v7 P& X8 t+ ?# Z WScript.Echo("Simulation Finished!"); |