Example of a JScript - F6 v" u! Z1 R1 D9 ~
var vbOKCancel = 1; 7 s, K t+ h$ y+ p* r* z& y0 l
var vbCancel = 2; 0 r9 L& H8 `8 b" U3 B+ ^0 p: N
var vbInformation = 64; 5 v8 Q" K2 x* x
var Finished=false;
6 @+ A9 f0 g! K3 S& _, ] ! ~" l5 B4 P0 z7 Q; q* T# b+ z j
var WSHShell = new ActiveXObject("WScript.Shell"); 1 V5 j4 a' ]/ s
7 M2 L' e6 e; t% | V6 p
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); x9 o$ ~$ J8 m1 C
* B' |" B! f+ g2 w, H* h* |
simple.SetLicenseType("Runtime");
6 h- x, _0 Y6 t* Q9 k" M. u
2 f" a& Z5 S- e0 Q* Q2 Ztry
. v2 j/ p3 x! p7 R d) c. J{ 3 A1 z T* e# P% |( o
// Enter the path to a model file!
0 c; P+ S! V( ] simple.LoadModel("C:\\Models\\Test.spp"); 1 V! t2 s% t# I! _# s
} , u& a% w, S5 H
catch (e) " X- i8 }0 l$ i
{
( q. d5 H! \, B7 T WScript.Echo("Could not load Model!");
R5 H: \+ U2 L- `9 W WScript.Quit();
3 Y; B7 U, Y3 U} ' K8 Z, }1 ^7 G
3 g7 C1 B- U2 Q$ |$ jtry
+ r% Y2 K9 i' T{ 4 o% o+ P7 A! b+ c3 a: y; f
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
) `" I% q1 x; T! [ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); $ v% m* J S& N1 m2 X6 e; u2 S0 n. u
if (r == vbCancel)
/ p' A, y# t" o% R! |1 Y ]0 N { 1 N( @* E, M9 w) {
simple.CloseModel();
, b7 l/ Q2 o* b6 P- @ WScript.Quit();
3 H" C! N5 r/ g1 j- O } ! I/ @4 W; b9 ]/ f- U( k
} 4 _ l1 i) y( `1 Z
' i3 w A$ R) z. U7 C7 I9 n
simple.StartSimulation(".Models.Frame.EventController");
& D0 N8 Y( c9 n" v
9 n. z4 Y X7 |. g& w i) rif (simple.IsSimulationRunning())
! _+ s8 M5 y" w WScript.Echo("Simulation is running!");
& k! Z8 @0 m' A/ a ) T8 a5 B* L" @4 l$ _" `( z, ]
// Wait until simulation is finished
4 h) M. i1 P' g" z, A% iwhile (!Finished) WScript.Sleep(2000);
) s3 Y3 Q" ?% O! G. |4 C( _
A; r. B- s0 y' B# r7 psimple.CloseModel();
; z/ z; j. e7 d% W) ^) H( k" Psimple.Quit();
" P8 |) N/ {' w) AWScript.Quit();
& j9 D0 u0 a7 u+ }* G
5 X4 V5 {0 n1 c6 {
( t; t6 K+ {2 a$ I: a% U0 O) wfunction RemoteControl_SimulationFinished()
. x) c: J1 S. ~1 r{ : e3 A) l( b5 }% |
WScript.Echo("Simulation Finished!"); |