Example of a JScript : D$ Y( C! Q& {7 q5 x
var vbOKCancel = 1;
I7 \! t) M1 f# b8 k" Q2 F4 L/ ]var vbCancel = 2; Z% W0 O5 L* J) k7 @. c
var vbInformation = 64; h0 W- h+ z1 U4 j/ _
var Finished=false; / d7 W) M) D& e6 t) P4 E1 f) U
$ C1 W% |, W7 [; s2 z6 s2 s7 ^/ pvar WSHShell = new ActiveXObject("WScript.Shell");
: z; K# W* Q5 n: V6 n- a& W + i% C$ @ w* X5 }
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
S6 q. A! [ g' j+ R- k. r
( @! T$ n2 r- f3 Xsimple.SetLicenseType("Runtime");
+ r) D/ p9 E" C$ ?$ o; e# G ; R- A, ]) h2 y- W- Q! Z- [7 @
try $ y' x) w9 q) _& ?$ ^
{ 4 U- k, z, {; q7 E! m# M
// Enter the path to a model file! ) H" d/ u- i4 n* M. z; O2 c
simple.LoadModel("C:\\Models\\Test.spp"); " p2 e) W$ {; B
}
" X2 O; }) R% v7 m9 u b5 m; Hcatch (e) 9 F4 p9 G# s; k2 H1 o. ?
{ ) S* F6 Q1 O5 Y* X8 A
WScript.Echo("Could not load Model!");
! [( t0 f- K" |7 n" Q6 @( S- ]* q WScript.Quit();
5 p- y* _+ F. n: L \& Z} 1 }) Y5 U( ]- }/ G, H# Q& C! k
* [& u6 G8 N F! Z" g/ J T3 X
try
4 ^- T" n( j5 Z; k7 ^$ x' G5 G _1 l{ 0 J# N" N& s4 Z5 a! q
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
( g' W* k+ ^7 q J$ H r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
! J6 t7 R; i; B i if (r == vbCancel) ( ~. E* \' y) L9 [+ h- g
{
9 X% v+ g% E7 N9 Q! }& _" D9 P simple.CloseModel(); : k; C: ^" T0 r6 u2 \6 E) R
WScript.Quit();
. s( U$ `, n; v2 w/ Z } ! e. g b' G. h6 e
}
8 q w- Y2 ]$ p
- t' [8 C- r6 m2 U* b, asimple.StartSimulation(".Models.Frame.EventController"); - s. o) j! x3 {
; [ ~# Q2 z1 m, P8 rif (simple.IsSimulationRunning()) 9 `2 ~5 }" g: Z) |" p/ V8 a
WScript.Echo("Simulation is running!");
% X4 J" f h: {# [ m" f
% _. P6 Y% j% d/ k// Wait until simulation is finished
4 O1 `; \/ _/ X& ?7 l5 c4 N0 Awhile (!Finished) WScript.Sleep(2000); 4 J3 p; x3 j" F- H2 {
1 I1 V- m5 @/ w' R' L2 @$ n( V
simple.CloseModel();
4 P* O" k. a: C# msimple.Quit(); * N* m5 o& x3 n* }
WScript.Quit();
& H: m8 I, `% s
' ]- t9 N2 M; l# k7 |- l& s ( c8 L, J K2 n# o& s4 e. e1 R6 J$ ~
function RemoteControl_SimulationFinished() 3 z8 a" x) P$ B' q' \% B
{
9 J; {* a f0 u WScript.Echo("Simulation Finished!"); |