Example of a JScript
8 j4 ?. ]! L, l4 [; l* xvar vbOKCancel = 1; $ e# s% k4 @7 D
var vbCancel = 2; 7 g, d! h% [0 z+ N3 b
var vbInformation = 64; 7 U8 E. r8 X5 T# z, d4 R
var Finished=false;
0 V2 _+ i/ h# S9 n7 i% I; O$ a
" V2 T$ P% O$ ?$ uvar WSHShell = new ActiveXObject("WScript.Shell");
& H2 c' X* h( U7 ?5 E
* U) s/ k) q, m/ T% Nvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
4 q. k% X) W. d2 d
) O" o% v& b; U+ X/ csimple.SetLicenseType("Runtime"); : [0 ?7 V$ i% D4 Y
A; E% j5 y, @+ a
try
2 \& ?6 G' s4 M7 q{ . p4 m x, e d C1 z
// Enter the path to a model file! 9 L3 M4 Q3 d( Z( m
simple.LoadModel("C:\\Models\\Test.spp"); 8 l. R" U o4 j1 ~
}
$ ^$ k8 ?" m4 ?( ?' ?4 }$ hcatch (e) / @( q9 S; i( N7 M' q, }
{
/ l+ J" J4 I# p- y WScript.Echo("Could not load Model!");
( V: g1 Z+ r. e4 v WScript.Quit();
. K1 o2 C: E- a" }( W}
, w) j8 d; I6 j- K. V6 u2 S " d. j2 G+ ]) s! p1 u, u! v" k
try
1 U. J& Y- u# S7 L& K7 K{ 5 o* }% }, {; S! Z% v
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
$ C; g1 {) q1 Q; z$ d6 c2 K* w9 x r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); - F f. m2 U! V2 `( F5 H5 B+ Y4 Z
if (r == vbCancel) * {5 p- Y) D# _4 X9 I% ]6 p
{ - H* j8 C# g+ i7 {* b7 i
simple.CloseModel(); & ~1 ^- @# G: a3 S: g
WScript.Quit(); 9 ^/ F4 ]. g3 e$ i1 ]: r! I u
}
- ^/ g$ E; Q8 x4 K4 S} $ p: T2 R% w* ^6 U+ L4 M( U
t" Q1 l' z% l3 ^simple.StartSimulation(".Models.Frame.EventController");
# z6 [ c# r! e
+ e& X# ?% ]/ v) C8 H; \) L0 a0 ^* Cif (simple.IsSimulationRunning())
4 }7 u! m# `, e. f5 U WScript.Echo("Simulation is running!");
0 b$ F% M0 c3 `! s5 L1 j# O: x b
4 h; p" E$ M0 n1 a6 O; C M' ~3 ^// Wait until simulation is finished : Y! W7 q3 o/ Z/ E* C3 D
while (!Finished) WScript.Sleep(2000);
2 U# B N1 @0 C% W" G( T , r q- v) o: J' E) S' |3 h9 r$ P
simple.CloseModel();
% `& D9 Q& B5 A P' bsimple.Quit(); 9 l6 k/ _, ]6 K" Y
WScript.Quit();
* D2 e) T; U! K" i
: H# {$ J6 n# J; g3 s+ H; t ! O2 L" {9 w6 r7 g
function RemoteControl_SimulationFinished() 4 f& H* M0 X- b' R' a$ |# _( Q
{ ( i O1 G4 `7 J7 P1 j/ g' S: \
WScript.Echo("Simulation Finished!"); |