Example of a JScript
, }' h4 j" K" n4 ]* Ivar vbOKCancel = 1;
; _/ z3 ~ Z+ Z5 `8 b; hvar vbCancel = 2;
) {* j3 `! \2 b# w. ^var vbInformation = 64; 5 V( u) C: x: P- P4 t! G$ V
var Finished=false;
; C" `0 J \2 S7 T, Z1 O; e
8 s; i/ e$ p! g$ [. Zvar WSHShell = new ActiveXObject("WScript.Shell"); ; _1 F8 x4 d. l0 [$ a9 ]
: v, L" U3 P. ~/ m( n# I
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 9 r* e9 e( u! U8 h4 W, D7 T
2 L7 B; o$ I/ b7 |6 D2 q: D% Z; I( @
simple.SetLicenseType("Runtime");
/ | Y$ M3 F* C' ]0 b' ^% ^
/ K( O' K! k! I& x3 htry 2 m3 {! l8 r* X! V# o8 F
{
6 |5 J4 c9 U' ^0 F // Enter the path to a model file! ; s: v: Z9 w2 r5 P5 o0 u& U
simple.LoadModel("C:\\Models\\Test.spp");
! ^' C. L! N. v* {}
/ W2 Q; W3 m* I1 S& scatch (e) ( x# ^ q. q/ I A0 M
{
4 }$ L# ~2 `/ i! ?3 A" c3 X# U WScript.Echo("Could not load Model!");
9 E# G9 A2 ^8 z, } WScript.Quit();
# z2 J% D. S* ~2 ?: v2 l+ q6 P! \}
& x- M5 w: ]/ d, A; Z- P
1 e) V" x1 w! b$ R/ A1 Itry : a# ^% a i/ D( t! _) |
{
; C/ T8 e; f1 U# R simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
6 u( k7 q- o# n% G r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 7 P0 s; {- X) ?/ u4 v& O( u
if (r == vbCancel)
8 n2 T7 r! N Y/ I. K) {6 f {
4 [6 X& J& `( Q: b G simple.CloseModel();
) F+ @4 F; r. H$ v$ t) d' m. N WScript.Quit(); . Q/ c1 \' s5 z4 b2 ?' W
} 5 o, U$ N1 G; n8 r$ X! |/ S
} $ Y& t. W- Q3 R4 |
6 c# p) G# `7 W8 usimple.StartSimulation(".Models.Frame.EventController");
- ~8 y/ Z$ J; P 2 z: f. Y8 G: @$ ?" o+ d$ r7 P
if (simple.IsSimulationRunning()) % \; w. w* K0 Q6 M4 r( T6 `
WScript.Echo("Simulation is running!");
8 i& ^: [/ O. H) w5 H2 q : Q+ [3 T: H1 P3 P0 r* {1 u9 V: l
// Wait until simulation is finished
! x0 z* g3 s* ?5 E( q, g {while (!Finished) WScript.Sleep(2000);
; l8 ]7 D; d" n2 v ?* I5 F8 F2 S$ {* ]5 P& \
simple.CloseModel();
/ V5 g1 K$ o4 ]0 x. @simple.Quit();
% |4 a3 `: H0 h4 d) KWScript.Quit();
: H! z' \8 z3 v7 x0 I# D ' I: J2 E7 [$ O
8 N( {1 |3 `( R+ m$ n
function RemoteControl_SimulationFinished()
) \; F [$ X- R{ 7 A+ x. i/ N# L9 C* C
WScript.Echo("Simulation Finished!"); |