Example of a JScript
* M( g% Q7 N0 g% ^7 Cvar vbOKCancel = 1; 8 l* P& n) I6 g) b/ p4 f
var vbCancel = 2;
0 \- ?! f3 Y1 C" rvar vbInformation = 64; [1 r5 R! |; k
var Finished=false; 3 V# j' i8 d' e$ Y# t8 W4 R2 h, ]( ]
- R7 }) D4 `. a, y5 M2 e* \1 m
var WSHShell = new ActiveXObject("WScript.Shell"); ; o( C* q( Z( J" j
( [1 z. C c0 Y; S7 `# w
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 9 r; a+ k5 q8 N% y* f
5 q/ o0 e- `, J% c8 @; O: msimple.SetLicenseType("Runtime"); ; k( Q2 l% u7 Q8 @! b
0 x, N# Y& e5 h( otry 3 ^! m1 ?0 ~4 L
{
Z' {# z- R; O! g // Enter the path to a model file!
4 A \( }7 L9 W. C3 ^. A simple.LoadModel("C:\\Models\\Test.spp");
8 A& g3 ^( v4 ]# h$ t; Z/ t% O} 6 e! k" y ?( r4 T7 j
catch (e)
7 J6 O" b% z, N/ C/ W+ d7 z{
' B/ K) W( a# @! _* h( \2 ?- j WScript.Echo("Could not load Model!");
7 y( i2 n# M: T$ \4 t* m9 G2 |/ ] WScript.Quit();
/ N2 `# K; l, f- \}
- F, x2 f0 Q* q* R8 w2 K 0 [ t9 i- u/ p' V. \
try
5 h1 E% h, Y/ W1 z0 Q5 Y{ 5 G8 L% w$ X, l9 G3 j1 V4 ?4 Z
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
/ d2 \1 j; c3 k1 ]% j5 H5 m r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); / t9 j O6 j+ L; o) g# Q
if (r == vbCancel) ) r6 m1 |. e, M" j
{ 8 g) y% R8 a0 H/ j
simple.CloseModel(); ( w9 B1 O: X. p' B% y
WScript.Quit();
1 S' P; P. ^7 T& r }
; Y0 ^9 l4 U% v9 Q" O1 W}
4 V, ^8 P0 q! S$ ~7 K" J ' V8 ~0 J5 ?1 d3 \9 b4 s1 S5 W
simple.StartSimulation(".Models.Frame.EventController"); k3 J2 r; q" c2 I" F I
3 u$ Z. D% u* h! ]; l" e
if (simple.IsSimulationRunning())
+ D. k+ q: s3 i9 _ WScript.Echo("Simulation is running!");
5 k# u! }. |6 L 1 `4 |: ^; A5 k4 \$ Q
// Wait until simulation is finished * v: Y0 w" I* w
while (!Finished) WScript.Sleep(2000); 2 H7 i' @& w' s3 e! U
1 l( Q0 j/ r/ E# J( _simple.CloseModel(); e0 q2 e! j& D
simple.Quit();
I; k1 b/ A% |( sWScript.Quit(); # Z3 l) J. [9 Z2 |7 U
( x2 K$ B5 ^2 i4 S) `. m: w
6 C0 L; x8 W8 t. j4 z
function RemoteControl_SimulationFinished()
: \+ O0 T- d0 G8 x x) R6 W: M{
5 q; Y0 R# M6 [' L: ~# A4 {+ ? WScript.Echo("Simulation Finished!"); |