Example of a JScript
7 K: H8 U- k# ]1 T2 Y0 x6 `var vbOKCancel = 1;
& N0 | J ?' m7 D6 L |var vbCancel = 2; # D3 @1 R- R; |" X
var vbInformation = 64; % U. Q N! e( b5 x7 [, _6 s
var Finished=false;
& R" |! e$ H/ @% s , ]" @- ]. u* G
var WSHShell = new ActiveXObject("WScript.Shell");
& V& S7 e1 z, n8 H& }0 Z & a8 [' x4 }( @
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 2 ~; s( ^9 [ n' Q% t9 e
9 }+ W! d8 N9 ~
simple.SetLicenseType("Runtime"); 0 w0 s/ L, Y2 z' p9 \: Q
9 m- o0 u+ j+ s* [0 x$ r' C% Y
try * V P' d' n' @' _. l
{
g7 O; ]' T0 i" R // Enter the path to a model file! ' e: h6 i! Z/ ^1 S
simple.LoadModel("C:\\Models\\Test.spp"); / |# d% Z5 k9 Z+ h# V$ {
} 1 e7 y3 P! O8 D' `% o' }' t
catch (e) & \0 y% D; c0 H( ]5 {
{
+ s0 O h& L1 ~. ? WScript.Echo("Could not load Model!"); 6 h }4 ~# M" f. V5 J# ~" [
WScript.Quit();
, u8 m# P7 u" K& b}
0 s/ V. x: k* d9 m# `6 f. k; t( ~
6 d* u5 O3 J, \+ g, K0 E2 \+ F! itry ; M( Z3 M( f/ @$ W6 Y2 c
{ ) K) I, g% x7 J5 o) X ~6 f7 ^
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ! D2 e; x0 G, L9 ?! ~
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ; o6 J* b0 r) V5 H+ ]# W8 |. K
if (r == vbCancel)
+ G/ ~9 `7 t! x. L! L; U! i {
$ O, M7 k; f; D$ K w simple.CloseModel(); ! M# ~- j9 t. H: L+ }
WScript.Quit(); 4 {# Y& E, x6 i8 I% K- \& H4 B
}
0 S4 `( y( f4 t+ v" y: k9 a# I} 0 z$ ?# { B; s8 Z H: r' V
3 ?- D' O) E0 t/ Fsimple.StartSimulation(".Models.Frame.EventController");
8 ]" y4 P q" b
4 I; Y/ Z' M) B2 K% Nif (simple.IsSimulationRunning())
D" [- Q$ N7 U: m WScript.Echo("Simulation is running!"); ) v) P$ [- l) _# J! c. E
. D1 L* O( J' Y0 z8 A
// Wait until simulation is finished
7 S# r" ?. r6 O" i4 D, Lwhile (!Finished) WScript.Sleep(2000); " o' @$ z7 A" l- p6 Z1 A
: c% b( k; _/ {
simple.CloseModel();
6 {8 _4 K% n& O" t( }2 ^simple.Quit(); 4 ]) p& w3 O( x( [) \0 r" N9 R# x
WScript.Quit();
. ?! Q! j8 r7 @7 J 7 ]" `' E6 i2 l) M; J
: |3 {0 ?1 p' C, |2 \function RemoteControl_SimulationFinished()
" R; g0 S: x/ w{ * w# ]. e- }5 J5 S& t; t, S
WScript.Echo("Simulation Finished!"); |