Example of a JScript
8 ^! U- v3 f0 ]5 Qvar vbOKCancel = 1;
" {. U6 u( P. l* O: @5 E. xvar vbCancel = 2; + v8 S# T" y6 I; U' f, }
var vbInformation = 64;
4 ^ c# S3 ^; K# g/ w3 U$ j. ?var Finished=false;
' Q6 q9 Z" c6 ]* T$ R9 ]4 t ' z* z' @9 D& `7 T+ R: a; Q
var WSHShell = new ActiveXObject("WScript.Shell");
& \8 s: S, X' a( V; R3 Q% x 8 H* R: u, A( N) ]- z% W# q) p
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 0 ?" j% O! G* _& K' d1 ^0 Q
* s+ U8 F& [# t" t5 u/ d& rsimple.SetLicenseType("Runtime");
1 ]% X; R/ `$ r- H3 `' u 5 T0 `- d% h9 P# s3 x9 j8 W
try 7 j! ~6 @ l6 g, C2 j+ `, Q
{
a# r" R# e- Z# W. [ // Enter the path to a model file! 5 w' s0 B2 B# @) V. ?
simple.LoadModel("C:\\Models\\Test.spp"); . Z+ E* [5 }# o: h0 P( k- n
} ) a1 d* D* x( x
catch (e)
2 d: L Y$ W+ D6 M% @& b/ f{ ; r ?) i( A" V/ m
WScript.Echo("Could not load Model!");
+ u" w; G8 A2 x6 w6 I: x WScript.Quit();
. [; A. \4 ~: {; I; c" r( _. j3 N4 A}
8 C* T6 y! H+ S B2 A @3 ?* r1 U5 F" y0 Z) L
try
; m, @- l% @; S- H9 D5 H{
, ] ]! _ B0 F1 d6 y simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { % \1 V: a7 ?4 H1 ^0 I! R. K- K
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 8 b2 `: a3 c2 s8 c! ~4 F! W
if (r == vbCancel) / {9 F- b' \' s5 L+ q! r( J4 ?2 H
{
6 E# s6 i9 q# T9 L6 t simple.CloseModel(); ( H% Q4 _5 v- y0 ^
WScript.Quit(); / g0 S0 L) Y1 b0 T
} ; ^! n! ^2 B0 P5 h
} 3 _( V/ H# s- \: d' P) ?# N8 w, c
5 j3 a; b* g8 Y- s
simple.StartSimulation(".Models.Frame.EventController");
* v9 [ P) \9 z q- P8 z, `
% \0 Q9 D9 ?% f2 L3 x; J/ j, r Y+ D aif (simple.IsSimulationRunning()) 1 c, k# k! a+ h
WScript.Echo("Simulation is running!");
5 b* A5 j) v L
" e4 Y" _! B& |1 l% ^// Wait until simulation is finished
% r6 a ^' |5 C& Awhile (!Finished) WScript.Sleep(2000);
2 ~! g, s5 K) R$ }
, x; P2 H6 r* _: Y2 _- h8 _simple.CloseModel(); & O) X0 e! d% K, ~* s- u" O
simple.Quit();
3 X3 z# o* \, I& R$ @5 t! fWScript.Quit();
& c) a u" b5 b. D( y% ]6 u' l+ ?
4 ]+ l) b6 C, U $ |. Z! N, S9 Q" ]
function RemoteControl_SimulationFinished() * F+ z+ L8 `4 i
{ 7 n( n7 P3 A4 o
WScript.Echo("Simulation Finished!"); |