Example of a JScript
3 n1 W$ e9 B3 R9 W4 D2 |var vbOKCancel = 1; 5 k; u: Y; S$ |7 |0 K8 r, q
var vbCancel = 2; # M& N6 ]9 Q* r( L* M
var vbInformation = 64;
( m" Y5 M3 z0 Y' Yvar Finished=false; ! `) n; v0 |( N% g' V1 F
( s3 p- e. Y, C6 h3 `) P4 R
var WSHShell = new ActiveXObject("WScript.Shell"); ) j3 }8 c& _. \8 i
5 J; [% H/ s. \* N3 S$ Q; e Qvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
! g, Y: Y4 U$ u: n ' T9 g/ l7 j5 O" \+ n. L+ X9 G
simple.SetLicenseType("Runtime"); ; f8 X6 l6 W, c$ \( @$ V2 l: f+ T. Z
& v; X7 L: I" \( J
try ( t# R2 ?! b5 N
{
4 u& g) {- D# Q7 j. }3 q" w! O. H // Enter the path to a model file! |% i) H7 O/ _0 h8 @3 i
simple.LoadModel("C:\\Models\\Test.spp");
9 A" N4 Q6 {- Q) q) ^7 l} 2 z& I& X& ~3 ?& n1 h3 i) ?0 M, r
catch (e)
# F- h+ f+ r# M% @5 E1 T& \8 X{
; L7 I2 i; x: }; D) q) X! I# w WScript.Echo("Could not load Model!"); 8 D# l- S/ A( G- C, p9 U o
WScript.Quit(); - A2 s2 P& p* v& k$ x- F7 w
}
, |- t% w3 P' A% @# [ # Q5 t) B0 F O: F
try 6 A x& E5 R+ |8 ~( M2 d+ C
{
' S0 o; N" K! }8 ~( _ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
4 ~) Y0 G9 ]7 Y- z" e r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
* _+ J3 u5 C- _" W+ t7 y if (r == vbCancel)
8 j; q) y- x' |" j. a) L( O' | { 8 A$ O1 h( }) a9 D, ^0 d
simple.CloseModel(); " Y, \4 h' Y# B6 L3 l
WScript.Quit();
0 S/ a( ?( b' Q9 V } * T3 N0 e6 E& P8 V8 ^4 r/ \
}
/ f. F) a, _. r/ F' a 6 ~+ u. S. f2 w( J; S
simple.StartSimulation(".Models.Frame.EventController"); 9 `. @: K! q2 `+ c; B/ n3 I
5 R1 M$ R/ L U- Q/ O1 O
if (simple.IsSimulationRunning()) 6 S) J1 ]9 _8 K: r) w
WScript.Echo("Simulation is running!"); # {; U8 ~+ U6 P
6 ?1 R3 i" _- x4 S// Wait until simulation is finished
( j, F: S0 _- Z6 x6 B% [3 h1 Awhile (!Finished) WScript.Sleep(2000); + {/ }! H! w6 j
2 G: U F, }& D9 E' v S
simple.CloseModel(); % ~0 u6 b7 W. n4 _7 X$ ~# R
simple.Quit();
' V& ]& r# ]) h; NWScript.Quit();
4 D! ^' O! c0 V7 d . H0 f& n, \1 W) C( q/ ~" p" l
" W% b& o4 q/ [2 u. B0 k, Kfunction RemoteControl_SimulationFinished()
; w! g3 }( {1 l6 J" i{ % v9 @) K' \( W7 V) e; G
WScript.Echo("Simulation Finished!"); |