Example of a JScript
0 W. A0 m" K7 u nvar vbOKCancel = 1; 0 i4 X! U9 d9 l) n9 c5 y( L& V$ S
var vbCancel = 2; ' ^, r# b& B. B4 ]9 X0 s, ?1 K
var vbInformation = 64; * d9 J6 v. B n6 ?3 h/ v. `, ?
var Finished=false; + G+ |! r% D& Q6 E+ B$ Z+ {+ s
* S7 e8 z5 `/ _& j& V3 f# Nvar WSHShell = new ActiveXObject("WScript.Shell");
6 x/ N7 H4 D4 K9 a4 H& l% _ k
, r. {6 ^9 y6 S( q7 \* b. Q9 lvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
" C) a7 R( a0 n. A* u7 p 2 g& r' Q. q4 k6 h4 \: r5 |& X
simple.SetLicenseType("Runtime");
# c" i% m! ~' ]( q0 n; Q( _ $ K5 a' E0 H4 G
try 5 U+ {9 N& K8 j: C, L
{ 6 V8 \3 ^5 @* u3 d+ E- `
// Enter the path to a model file! & o3 Z- `* j. v0 ~
simple.LoadModel("C:\\Models\\Test.spp");
3 f3 n3 I' V& e} + K- @* T" [ C
catch (e)
0 Y6 x" V- }/ G. o{ + h1 H7 p! W' `3 h/ l4 G: N+ _1 t4 J, i
WScript.Echo("Could not load Model!");
! u3 U# f$ U! i: H WScript.Quit(); ; L; Z) X u& k, m5 V! j
} + H& N6 y" y5 g7 l/ z2 c
" P! o+ e6 c$ `3 ?try
- E. X0 U# i2 x& E' ]& R/ U{ ) g: W$ A4 B, j; ]7 y: _
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { % R i* {& F& v+ @9 P% H
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); " B9 X1 a; ?# z; X# }
if (r == vbCancel) / r$ G' ^ Q( ]7 _+ b; m
{ ' u" C3 U9 j. [; }* t* s& G0 h' `
simple.CloseModel(); ' |4 e. G, ?( n+ S+ v. }8 V
WScript.Quit(); $ s- C: I! Q$ [" j- }: S; s: Y
}
{( ] p1 @6 i# ~- k}
) }- p/ ?, [; k
! v& K. _; H8 H" G! \simple.StartSimulation(".Models.Frame.EventController"); ! m& u; U; y/ }1 M# t
5 L4 j3 j$ T( B8 S
if (simple.IsSimulationRunning()) & c( ^* S! q; m3 m$ y
WScript.Echo("Simulation is running!");
" p( I: b. f' Y: V6 J; Q$ W 1 s8 }. c9 i# H5 z
// Wait until simulation is finished
$ z7 ]! [+ A/ K" L y" Xwhile (!Finished) WScript.Sleep(2000); + N- k7 z4 s# J3 n' [
) s4 V4 z1 j) w: u( R9 B% M
simple.CloseModel(); " V# l |, v3 H8 D) o
simple.Quit();
7 m* l! `% i# G, c' v& s7 h; eWScript.Quit(); 2 r# j7 ?: ] u
; {, M9 o) s( \* { 6 M$ n) \- l8 _) \6 f
function RemoteControl_SimulationFinished() 7 |$ a! l$ q5 N k
{
& a# Z2 a4 n8 z5 N. f WScript.Echo("Simulation Finished!"); |