Example of a JScript
+ _7 r) x% l2 Qvar vbOKCancel = 1; 2 [6 A4 o2 q) V: Y1 g) ^% y- w
var vbCancel = 2;
9 h; B8 S8 ~' N- d2 }* cvar vbInformation = 64; ) ?/ X K, |6 @* a4 W8 A0 z
var Finished=false;
- @& a1 G8 p$ q, W, F . P) }8 S* ~) A1 A7 A: n
var WSHShell = new ActiveXObject("WScript.Shell");
2 c ^9 o9 J( a# ]- q0 p, E8 I4 }# w 7 l+ l/ d7 ^, p6 [0 e4 G' D
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * E6 P3 A/ E5 T2 E5 w+ B1 w! I
2 ?+ E" ?5 |' ^$ Y3 E" {2 n. R$ [simple.SetLicenseType("Runtime"); , l4 h# ?# j/ Y: u9 x0 E
|% b7 |6 B- R/ I
try
* t( T! `' q4 ~ A5 }3 T{
- K5 R N4 ?+ W) w( a+ t2 i; H+ [ // Enter the path to a model file! ) D2 `6 q4 y$ `5 `$ l' g9 j0 c
simple.LoadModel("C:\\Models\\Test.spp");
4 M/ [9 W3 ~ U: |) E} # Q; I4 {2 A! a/ S' P
catch (e) ! O6 \# }4 Y- F. W& R
{
* d7 F5 y# m8 c P/ y WScript.Echo("Could not load Model!");
& |2 n; k% Z8 h; Y0 o1 X9 C% l WScript.Quit();
* P2 f0 D6 I! \# R8 O}
$ \, }4 f# L% Y. I2 t( n # A! L3 T; W, h
try ' C. b6 e& t: ~ o% \
{
$ K0 O8 V7 ~, h1 P: g5 A8 A. V% p simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { " X1 o+ v4 P i6 Y
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 1 O& d" g0 H% r
if (r == vbCancel)
: D0 z2 s' R( |5 i7 a { # I* J9 K; Y) K3 T. I' G! J) o
simple.CloseModel();
* e- c4 v7 b& P. S+ T WScript.Quit();
1 x* A6 L' D* p+ a+ S' n } 5 J6 u# s* |6 v" i" ]% H- s
}
3 `* ~ }7 y# s3 p z' d! M! K6 G, i
simple.StartSimulation(".Models.Frame.EventController");
; o0 G$ ^7 M+ s! m
! V5 ~ e) f6 X( g( M7 S# Iif (simple.IsSimulationRunning())
' ]8 }0 _" q2 P/ D2 _2 X% P# | WScript.Echo("Simulation is running!");
8 ?$ x! d( |/ F: N& a/ ~ K ) Y* A. e3 b9 S9 w
// Wait until simulation is finished # P* O4 S s& p/ l! T% I. w1 Q
while (!Finished) WScript.Sleep(2000);
4 V$ z) Z( `3 L3 p9 g4 r
/ |, l3 _. z9 f/ i1 tsimple.CloseModel(); 8 N, ^- X/ E+ E& s, u1 ]5 [
simple.Quit(); F9 |6 x" q% D& T V l. h W. R
WScript.Quit();
C Q. R" s5 r4 \# l( d+ G% u 4 C7 N3 A- ~0 r4 M
# p% V- s2 S3 }: j
function RemoteControl_SimulationFinished()
x, W/ |9 a0 Z+ X- N$ I) K$ q{
* E0 J, A7 t( \& O Q. W1 U, G, S9 Q WScript.Echo("Simulation Finished!"); |