Example of a JScript
2 C! Q' q! {' V9 A, Yvar vbOKCancel = 1; 6 h1 Z' I8 ^ o( Y& e; t1 \
var vbCancel = 2;
# U$ V6 j+ Y/ A! B: |4 I% t# Yvar vbInformation = 64; 9 Z0 N4 }9 C2 W' X3 e! P% @( f
var Finished=false; ' u6 F' \" C: `1 ]! T; R
7 K a4 q) x5 X8 g% d6 `* {+ r
var WSHShell = new ActiveXObject("WScript.Shell"); # J' @2 g* M" ~2 X
- X8 n( S- {! s z' d
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
& v* Y) m {. S1 Y# t( W/ `* Z M7 f8 O1 c; |2 E+ I m
simple.SetLicenseType("Runtime");
7 v# G$ H3 N' R, O! H/ }7 Q
! z" d' o" V5 B. f& Otry + T1 @2 ~; J9 m
{
8 f- m' P) l, A/ | // Enter the path to a model file!
2 G3 Y o0 F+ M# K: _ simple.LoadModel("C:\\Models\\Test.spp"); 7 G' n/ b0 x9 X. l$ _7 q6 Q5 }
}
* F) `- [7 v) ?" {% P; hcatch (e)
9 L; G! z# @& A g* s8 y9 r{
1 Y$ b' `) d# A1 _/ g: \ WScript.Echo("Could not load Model!");
9 P- d. I6 T4 h( D WScript.Quit(); 0 d& l; x1 y0 l! N, ?- g
} 5 P# b7 j5 M/ z# Z
p3 l/ ]' E. j# u3 N8 k
try 3 M9 @ ^1 |: W! |3 C
{
5 q" {3 Y; G# Y; P" m- Q simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
4 t. n2 N3 \+ T% r& h7 G r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); $ \; A: W9 W9 h0 J0 _3 L" J
if (r == vbCancel) $ N: ?" t5 i. H$ l4 B! R3 A2 k( w
{ 3 Z1 _; y# K8 y0 p- ^: M
simple.CloseModel();
8 Q5 {$ ?# { @4 W1 c8 G WScript.Quit();
$ l* J; j4 r9 D# h9 o5 R }
8 A3 l( S( [# c$ D, B+ V) }# I}
4 @( J1 T8 W; J
" h& ^4 g! t8 F2 B. i& Xsimple.StartSimulation(".Models.Frame.EventController"); 5 j+ F( f! `7 G5 | ]
: o$ I1 \) [- t. {* f4 S9 gif (simple.IsSimulationRunning())
: Z! p, w% s7 M WScript.Echo("Simulation is running!");
2 I2 U5 h$ n% h( m) O) ]- |
6 N* _5 R2 J, |# C- o// Wait until simulation is finished
% ]/ C, W1 J* t4 Q# awhile (!Finished) WScript.Sleep(2000); 4 @1 b7 i8 w( G# Q; n3 {
! ?, o2 r7 p- ^! `! j
simple.CloseModel();
! l+ ~# f+ M0 Lsimple.Quit(); u5 ?# K0 z- L$ r- Q
WScript.Quit(); . H J" ~5 K0 R4 l2 K
( ^+ i% b' a: m
9 {6 i0 D3 l) a* Y8 g; i. {function RemoteControl_SimulationFinished()
9 R/ _" q- f: [4 v{
7 |' |$ z: K$ n WScript.Echo("Simulation Finished!"); |