Example of a JScript & Z% O/ G" V: e9 `
var vbOKCancel = 1;
1 |) U) c2 e: O3 P% e3 d1 `5 {+ cvar vbCancel = 2;
8 } F0 i& A! ]! Nvar vbInformation = 64;
$ {# j7 p: t- r, T1 x" uvar Finished=false; # X: b# {2 ^( t6 u( g
% U1 G; Y5 W9 }! `" P7 S/ [5 S( \
var WSHShell = new ActiveXObject("WScript.Shell"); 1 Q" y$ F8 Y) _6 h$ @/ X! ]! H Z' G
; g4 Y% B* u' f- L; t& b) |: p* y
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
6 r8 k0 L7 e. w 9 `$ n6 P- Q" b& l% B# ?7 `
simple.SetLicenseType("Runtime"); 7 P( P1 @, H( T \
$ p9 B3 x& w9 A, }- v$ c! o
try
D6 m4 s" R; Y+ X% m{
! e% H5 d0 F; V7 p A; k: f+ i // Enter the path to a model file!
( V5 r1 X+ @! C. [# P7 j5 B B simple.LoadModel("C:\\Models\\Test.spp"); & l+ g) n& j* Q! V% J0 n# b
} 4 g, P8 t, y$ Y6 W% P) c" `7 C1 D3 U
catch (e) % F: e% u; w+ G/ N' {
{
7 f; k/ k* _( n( t$ o WScript.Echo("Could not load Model!");
; }7 C5 w! L9 m' R WScript.Quit(); + [/ A0 o* h f; b) a
} " ~2 }' a* s& y- _
% ]: D" [; Y5 R; R utry - \2 s$ Z$ c0 A
{ 7 [! Y- E( N' U* W% z% s
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { " s) b- L$ @' o. B P3 e
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ! e/ ^" {" c& k
if (r == vbCancel)
2 Q7 T, m. K' I; p4 z! Z {
# B/ s9 S' \# ] simple.CloseModel();
+ u3 y- ]' J( I- Y }! m WScript.Quit();
# N, D9 d \0 R3 G5 l# j" P' d } ' y( y4 Z U' t% w: L) R' W6 T
}
. h! R& u0 u$ e7 H2 ]" o9 F6 ]: G0 }# a 7 e0 X$ J9 V4 B% g2 {
simple.StartSimulation(".Models.Frame.EventController");
! n$ G8 j; U) ]2 ~( |% c" z0 p
! F8 e( _# ^4 `7 k" cif (simple.IsSimulationRunning()) . c+ ~1 p% w2 \- f& b
WScript.Echo("Simulation is running!");
+ L9 g) X- y- m # J9 J6 C$ a5 c' l$ r5 A' h* E
// Wait until simulation is finished 1 s# t' p |6 k- S" a, b
while (!Finished) WScript.Sleep(2000); ! A' j4 z/ A! \) [! k+ X
- c4 H/ W/ `# vsimple.CloseModel();
4 U, ], e- O9 l' usimple.Quit();
" x% N& M' N8 n' @. GWScript.Quit();
- J5 k! ?: F. e1 L9 I9 V, C5 {" I / \! V, u. `+ L4 s1 W
1 ~/ H' T3 ^2 |) O1 P+ ifunction RemoteControl_SimulationFinished() - V( m% _% D* o9 _
{ ) i& Y3 U! a. S7 S4 w3 u
WScript.Echo("Simulation Finished!"); |