Example of a JScript
4 @2 w" I5 V* n9 R6 a! `* Wvar vbOKCancel = 1;
' q+ d+ A0 @, q& [ Pvar vbCancel = 2; ) |) b" p$ f$ W* B6 U- m
var vbInformation = 64;
5 |# x7 Z: E/ }* I9 G/ L( Lvar Finished=false;
5 _1 j+ u& C2 y4 p# | , }: \* l( \0 P v7 Q6 D% Z: M
var WSHShell = new ActiveXObject("WScript.Shell");
8 `. Q7 q" }8 K1 F 7 o8 }0 j. o4 i$ R) z& P! i! {
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; o$ v1 v4 }2 }7 v3 N 5 Y3 r- r/ x+ w+ f! q1 K
simple.SetLicenseType("Runtime");
5 R2 T6 d8 j6 k, O3 D
4 ` x! ~6 @7 Y) c+ b2 @! Btry 9 k$ m( J) h- `/ B
{
" T8 v7 t8 L$ F. x4 z) }# u' p // Enter the path to a model file! + S8 J: j9 H/ Z4 B" P6 _
simple.LoadModel("C:\\Models\\Test.spp");
) ~9 E0 ~- t" x. v5 ?5 h6 r} / l6 t+ c- C( O0 `" \2 L
catch (e) , m0 Y8 e3 f- q, I
{ $ p4 W) o/ A; ~5 o
WScript.Echo("Could not load Model!");
2 Y& b1 x5 Z- n! p) M; X4 i WScript.Quit();
$ s& x. d# H& K} & ?0 o- E3 F3 f& }! U
# }+ F3 ~' L4 G# u3 B& d
try 8 j! y! f/ p' f( P8 o! d
{
0 k% [# S" h5 l! f: Z D# v8 U2 ] simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { . v: ?- z- ~5 P9 V" @
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); % \3 `3 _4 L# [* y& h9 |5 Z
if (r == vbCancel)
/ a2 j0 A) W9 T' x+ ` { ; {$ J0 X7 p u. w
simple.CloseModel();
! K3 I& C8 g. q WScript.Quit();
( K1 K8 I5 j% q; o7 V& ] }
, \2 t% Q d* C" P1 N- ]}
6 L: T3 c- ~# {5 E' B7 v
# J3 Q ^) L a: vsimple.StartSimulation(".Models.Frame.EventController"); , w% T2 w O x7 [- [: l
2 U C2 s- U/ W) h, c
if (simple.IsSimulationRunning()) 3 N& p( G$ T2 s
WScript.Echo("Simulation is running!"); , |1 M/ l; I1 A/ T% m1 G' K
# |# [) B. d2 B6 t p4 d
// Wait until simulation is finished / @ Z/ ]& ]& b6 r Q2 `* Z! k8 }
while (!Finished) WScript.Sleep(2000); z+ x6 ?) @. M B; J5 h( ?
{6 _9 E9 J4 e' |7 a
simple.CloseModel(); * m8 c+ R6 f& {- N0 c
simple.Quit();
: _! m+ ]* y; v7 z9 [/ w: cWScript.Quit(); 0 b8 M5 T0 [. X0 B, Z
' t0 [5 e4 {! m 9 w& g! ~0 ~" _* K) T& ~4 L1 L
function RemoteControl_SimulationFinished()
6 N5 y" Y- b* q* k! J4 k* Z8 Z+ C{
" H2 V/ O$ @2 m# {1 p$ H$ W3 j5 N WScript.Echo("Simulation Finished!"); |