Example of a JScript
3 l# i/ J' w% f3 |+ w; _var vbOKCancel = 1; . a: X5 J) N1 Q g6 X6 s
var vbCancel = 2; $ y8 Y4 }& ^9 K K
var vbInformation = 64;
& t# H# v+ z- v* [var Finished=false; 5 H0 B. @4 x0 A6 f& r- C7 s5 V
' C7 x* Q/ O5 w. Y" w/ _
var WSHShell = new ActiveXObject("WScript.Shell"); 2 @, Q1 Q, L) }$ q+ t
, N$ m$ T# A8 D. _( ~
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 2 p* p0 x- k7 `
8 l/ Z3 h2 r* o$ Dsimple.SetLicenseType("Runtime");
2 e2 u) n. i% u$ E( | * j0 O6 W; J3 T% Y0 y4 l
try $ `, |9 I8 T8 e% y7 q0 e
{ 8 ]8 ^1 d4 T7 V4 d5 N
// Enter the path to a model file!
! s1 U* ~7 F @. j, K2 s simple.LoadModel("C:\\Models\\Test.spp"); 0 T2 j$ ]3 o( V; C' k; i
}
3 T' C7 X: Z" e) p. ~6 Ocatch (e) / O: E# p! {7 V! G# _& M: @
{
! y; T, V% d0 g* m! n WScript.Echo("Could not load Model!");
* S% G M1 Q3 p5 o+ F& z WScript.Quit();
) f! c6 j3 O. [7 v& d/ U& j} ! e6 D0 @- a6 H, U4 j; i; q* s
8 O1 Q4 T6 ]% U
try * X1 M. P/ `% X2 {6 d4 N
{ ) ?& m' h& X/ A$ z* ]' ]' l4 V
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
5 n' ]; L1 f! ?! @ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); , v+ K& T1 `) `3 n: `- f
if (r == vbCancel) $ a, r0 b/ U7 C$ s0 s3 M$ i
{ . \, X# `( o/ S; @7 I1 e# y
simple.CloseModel(); , ^) ?) E; A1 n% R! S, ~
WScript.Quit(); * B+ X) h! D/ G
}
9 r, |0 N' ^: u+ T6 ~* Z}
0 C( E5 U9 u' M/ `8 M6 I/ o' z0 m : P' _3 U4 R5 B' S9 ~( e/ D
simple.StartSimulation(".Models.Frame.EventController");
7 b3 l: y; |- T. S+ U4 g; Q7 ^+ k' N ( d9 o+ }- f" `2 ^
if (simple.IsSimulationRunning())
8 r% X# f# j, Z+ Z WScript.Echo("Simulation is running!");
; Z, D+ F" f0 E* S) k; ]- k
+ y+ e4 Q1 I; c// Wait until simulation is finished ; `! `+ n7 p f' D/ }
while (!Finished) WScript.Sleep(2000);
% A$ l `. Z) a9 q 5 J4 ?( M+ }* g
simple.CloseModel(); : n# n* N* I; n7 ]$ G- d" _; A
simple.Quit();
4 c' \6 |: z/ K3 bWScript.Quit(); 3 j9 i) b. _' _
5 R& I8 L% @+ r! w% \8 v3 L9 K
1 r- T3 H( y2 h9 D, K
function RemoteControl_SimulationFinished()
3 D# p3 Q1 m; S. G) S1 F{
5 V) H3 N8 ?6 E/ F) g WScript.Echo("Simulation Finished!"); |