Example of a JScript
. N3 z7 G0 L; V% {var vbOKCancel = 1;
& X6 x0 U0 Z1 X" h( ~: Yvar vbCancel = 2; , A6 [- [9 l$ w: B( m" u+ w. i7 E
var vbInformation = 64;
2 n, W% ?1 P8 B! Z; L( g( dvar Finished=false;
3 P/ H& g! y6 W# {, B9 c( |/ ^1 ~ - r }, N7 G, }$ R3 A
var WSHShell = new ActiveXObject("WScript.Shell"); - J1 K) z8 B/ m. v
3 I* `% [7 H; B% b5 w! k3 y
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
) n0 e: ?, P/ j( W8 Z/ E5 Z( h
1 F. A( W2 r% g$ [simple.SetLicenseType("Runtime"); ) c& w+ p! [) b
1 F8 I1 Y7 r7 k: \% Otry 6 t* I* w& } a. U( _
{
) N, J, c$ X; @5 A, r2 ` // Enter the path to a model file! ! x* i6 }7 B, H' R
simple.LoadModel("C:\\Models\\Test.spp");
0 b" F7 s6 @) G: k T}
- N E) [5 Q* O0 m: [; d3 i! g- _1 wcatch (e) 9 i! v7 U8 J8 j$ L0 f
{
/ H% O; k! q4 m9 z$ ^ WScript.Echo("Could not load Model!"); ! j m% R* n/ d- Z& `* U
WScript.Quit(); ) D# ]' R) W( W# C& O
}
) k& N- H% m) I$ |1 n; n5 L
5 R( n: B8 \* c6 x |4 w7 B; u3 Y) Btry
1 r) h m3 \& P( B{
' O. o; p, ^$ U( X' P; `& V simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 1 ?% y$ q. R3 P& w# z# M6 ~9 |; m8 R
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 2 F9 o0 l8 \7 k$ p- ~6 g
if (r == vbCancel) 7 b! r' g( v0 m/ q
{ " g! \0 w: d4 y5 k- B7 z
simple.CloseModel();
$ N/ I4 E; {" z# D- [ WScript.Quit();
8 {8 t. `% X9 z* t/ K } # a6 H9 k$ E1 ] u$ E3 t. R P
}
- g/ V* Q, K8 {' r$ Y I8 X: G
( f; D0 p% Z+ g* i3 _% _6 Ssimple.StartSimulation(".Models.Frame.EventController"); 7 c( \0 t8 _% e$ O3 \/ C( G# N" W8 M
& U9 @# U. D, Y2 b& w' ~
if (simple.IsSimulationRunning())
0 C8 k8 ^9 G' E1 K; e1 O WScript.Echo("Simulation is running!");
9 m+ c- N) j( ?( f . y$ q- _- b" N; c$ W0 k% w# d4 H
// Wait until simulation is finished / }! u5 E1 Q l2 ^# p
while (!Finished) WScript.Sleep(2000);
# ]! i& ]5 F' X% s
, s+ F# Q7 H4 X2 Fsimple.CloseModel();
" z" l/ ^* C. T( g' t4 k5 Rsimple.Quit(); / \: @+ S. D j# c3 @5 p X
WScript.Quit(); ! J M } G- ], P6 x& z
$ a L3 h; B; N2 P% _- { ' s" ~, ^1 w" k4 v0 n# ^% i
function RemoteControl_SimulationFinished()
3 S& ]4 h( F T0 l1 R [{
1 a" S( |. X; E, \ WScript.Echo("Simulation Finished!"); |