Example of a JScript
6 b: s$ G7 P. R) w7 f( qvar vbOKCancel = 1; ; Z1 J2 {: y/ }; n
var vbCancel = 2; h! E6 U- a0 }& B! E+ J$ r
var vbInformation = 64; , i7 {' N( S) u4 f
var Finished=false;
, F0 j5 j3 ]4 w+ k# g5 `% A : c% A' E/ y. |5 F% @" z& P" z
var WSHShell = new ActiveXObject("WScript.Shell"); - `" h/ Y5 p: |8 q. u
2 U; n$ J) b# k5 v" Evar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ' q% i" `2 _( t O& W6 \/ C
1 L9 v% S- u4 {
simple.SetLicenseType("Runtime");
* ^3 O8 A0 r9 u2 @ |8 A# y
" p; z& }- {, D _# q" b& i% utry
4 b+ U" C" |0 b5 Q3 |$ K{
. B& f, Y) ~; H( W* X {+ n/ V // Enter the path to a model file! & A" ]# A& E' a0 t7 k
simple.LoadModel("C:\\Models\\Test.spp"); 4 o: ~ W4 P* q1 }
} 6 ^: S- \, A1 E3 A
catch (e) , m5 H$ g8 u. {3 `5 C
{ ( d6 |+ G$ K) e( T
WScript.Echo("Could not load Model!"); & r+ w& n$ L) A5 r5 _- k) C8 [
WScript.Quit();
6 k8 f5 v) o |" D0 y0 W0 \! h5 ~}
( A3 {, c# a6 V9 T( G* D) H
' @! t, q8 n& [) Y/ E7 v# J. ^try 2 a7 B' `2 @* \2 z# B
{ # X, s8 b0 e7 a3 l$ r
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
) C/ t% J4 E; z9 f( N5 Y4 T r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ; a: W) Z/ Q7 U, X' s
if (r == vbCancel)
! D/ `, o1 q( I5 h* D { $ ?, f9 F: {& G% m1 ]0 d b
simple.CloseModel(); : o( ]$ {1 ^+ I' @9 y- `- d/ T
WScript.Quit(); ; g9 p2 s: `! k# c; N. e$ a
}
& ^% p! A: b5 ^4 k# X5 C$ {} . Z3 o/ R6 r, |" q7 m
! g$ a0 e* r o, O1 x# n
simple.StartSimulation(".Models.Frame.EventController"); . q4 F+ l9 X; j2 x
, t3 i% y4 P C5 B: h- |5 k$ Y3 Xif (simple.IsSimulationRunning())
' b+ u/ } g; b& X$ K8 |1 ^- j WScript.Echo("Simulation is running!");
$ f' H. b6 ~) a& E6 `, { * g' F. S# N& p0 X7 [* E
// Wait until simulation is finished . m& r. R7 i$ v+ }3 @, l
while (!Finished) WScript.Sleep(2000);
q4 K. B& G8 b9 Y6 Z # F: j& ]3 i" B& D0 v! m
simple.CloseModel(); ; C; a+ I, ?! K- V. S$ L0 o
simple.Quit();
9 ?6 a! b, }2 S( X, c# OWScript.Quit(); ( e: A, q2 ?7 ]
% n/ I3 _5 F4 j; ~6 C0 Z1 r% h
3 ]$ O$ Z2 ~9 t' x! ^" S3 P9 [* q9 Cfunction RemoteControl_SimulationFinished() 5 i6 B) j6 ]; z4 B- z$ B
{ + `, A2 [7 ]8 D* p! s! o
WScript.Echo("Simulation Finished!"); |