Example of a JScript : \, ~( {$ P- V
var vbOKCancel = 1; , k0 P4 h2 t4 z7 F+ K% H9 I. L+ `
var vbCancel = 2; " y$ @% v) ?8 E% U5 u. b; G
var vbInformation = 64;
: ~) b9 n( i/ Yvar Finished=false; 7 B6 ~- Q3 K* `
+ G2 w$ r* T( I* p
var WSHShell = new ActiveXObject("WScript.Shell");
- d% \' F6 ^$ m9 o8 q 8 c' h2 P3 T% B; o, v( L
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
, `3 @) q7 v* J
, e0 ]3 c. G x e- xsimple.SetLicenseType("Runtime");
+ ~# ^+ z9 I) }7 G: ~1 H t8 B7 @4 k
. d+ ~' r4 Y6 H7 Atry ! @' S: W& O, J- E) O) m
{ + M/ M" T& C" E7 o7 |+ f
// Enter the path to a model file!
$ x8 p" m1 \+ Z- p, v3 \, e simple.LoadModel("C:\\Models\\Test.spp"); " j" i' R. H6 K3 s7 Z& K$ a, w* D5 P
}
5 K. ~ w8 `( ~+ Z# b3 d9 j: S( F+ Ycatch (e)
( y8 Z1 n+ G/ k. m2 {7 j9 _{ ' E$ P" J @/ c2 x
WScript.Echo("Could not load Model!"); / z: Q6 y$ _- H' G( Y5 D- a7 C
WScript.Quit(); 5 n O# C3 G# j, W
}
1 }2 S4 g2 J! S) s ( ^7 x( u! q) m: p
try
& A4 e6 h, W0 N, I1 D7 J2 I- f{
: s' `6 W `* L6 @) v/ s simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
% Y; h( {& n7 x. ? r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
/ R% K! S/ {" R9 e4 a" ? if (r == vbCancel) - ~% `/ P( L2 A
{ : [/ @& i+ U: i1 n* W' D* e
simple.CloseModel(); ( ], b' |4 |* g; U' E0 |* D4 A) _
WScript.Quit();
# B2 ?& d5 o) M8 r! T4 D3 ] }
z7 c- `5 I \8 h( h} 0 P3 Z% R |, E) E
/ x9 x' l6 ^% g. m9 r
simple.StartSimulation(".Models.Frame.EventController");
4 Q5 F% B8 J* T5 d& ?/ \ : I# U7 E" z, ~- k! o9 `9 o9 o. m
if (simple.IsSimulationRunning())
0 k0 H1 ?7 C% C4 \! v" A' A1 y9 a8 s" ]5 E WScript.Echo("Simulation is running!"); 8 p" S& N" l# x# S. F3 m6 o
& O) Z3 z% R7 u0 _' |// Wait until simulation is finished
9 Z) B: c# G) fwhile (!Finished) WScript.Sleep(2000); % z' r1 h+ T) K# [2 R/ z: }, i5 h
& d5 V& z1 Q1 Hsimple.CloseModel(); & I$ ]( n T" T x
simple.Quit();
( O' C5 @% @3 o& Q7 w+ TWScript.Quit();
- }8 N& d& F5 ]: u, M$ s
: A/ ~, n. C O9 R7 Z 4 h/ W7 H8 Y* f$ J6 L4 O% P- P
function RemoteControl_SimulationFinished() % R8 Q7 a0 [7 M
{
4 H1 a: u* F. f- |9 p WScript.Echo("Simulation Finished!"); |