Example of a JScript * q* @1 l C8 k. ?
var vbOKCancel = 1; . n% B5 r, o1 f" V, ^5 b8 I
var vbCancel = 2; ; \ p$ P2 S; ^- d# Z
var vbInformation = 64;
k4 c# n J: Q2 Dvar Finished=false;
) L& `4 Q- K3 \ ) g/ q6 |) ]) A- ~
var WSHShell = new ActiveXObject("WScript.Shell");
6 O2 C# @! z- Z* L+ X
) ]) I% S+ I. `# g9 y0 Dvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
# p) a4 d% Z) D; b0 J/ G: t ) V7 Q* V; x M1 Q
simple.SetLicenseType("Runtime"); ( `; g, |% c3 ^, j6 [
7 o0 b, O+ [) l6 b) d% X1 E9 q
try % a. W- W$ ?/ W
{ 6 q8 R: l, ^+ {5 @3 q
// Enter the path to a model file! + ~$ @+ j9 L( \6 g. Q, m5 o' f, L/ o8 k
simple.LoadModel("C:\\Models\\Test.spp");
% z4 R% d1 q9 i t9 x7 t} ; V& F7 k n& [8 [7 f6 x
catch (e)
" r Y+ ^6 u8 H3 H3 Y{
) O2 F) `6 B: w; s$ m WScript.Echo("Could not load Model!"); ! _3 W& M' v+ |/ D( R" I# J
WScript.Quit(); 1 t( T$ i' p1 t8 i' ?
} ! Q; i& E! E) q P5 ^+ W
! C/ p: O- |. f
try
& [. S! l9 z1 o/ q9 [" U{ " }" ~! Z- r( v h4 J1 i& J
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 4 S8 w0 U8 {$ p& e
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); - I+ f1 `9 P0 `% p4 L. s
if (r == vbCancel)
* g9 J+ ?9 p1 c& `' N {
. ~! E& P$ X3 J simple.CloseModel();
$ s9 ]$ o: [. Q WScript.Quit(); 0 C9 b1 o2 [5 {9 L+ L) F1 K9 G# o
} : I# e3 Y2 T, j, }2 K3 ?
} - b5 p$ U+ h+ F6 d
0 |# _ G; r6 [8 m# Tsimple.StartSimulation(".Models.Frame.EventController");
. S& O; y) d( o6 n
* t" `: m& d8 l8 d" r* A# M+ C- lif (simple.IsSimulationRunning()) , z9 B1 |9 c u. M2 F, Q, N
WScript.Echo("Simulation is running!");
h( T2 l. R6 d* a$ K* R ) E3 B$ j9 `5 g2 {% K7 o* c
// Wait until simulation is finished ! ]7 Z3 k6 ?4 h' l' W6 E
while (!Finished) WScript.Sleep(2000);
& W7 v( l" _2 f9 b U# H; e ! I1 ^0 J/ G. S5 m4 S0 Z
simple.CloseModel();
' A, h1 u6 D+ d) e, [* Bsimple.Quit(); ( C% V& E7 U+ z( L8 W- s
WScript.Quit();
9 z7 p1 M. ]4 U. I
# y/ [* d$ F( x/ `/ z 0 j) @) H& U; h8 s$ e7 ^# p( Z j
function RemoteControl_SimulationFinished() ) V! B1 `3 l4 ?3 H8 j$ I+ W
{
. \" N9 J$ A0 y6 c5 ] WScript.Echo("Simulation Finished!"); |