Example of a JScript
4 A, o/ W; D2 d l* N4 Gvar vbOKCancel = 1;
/ \+ K, @8 ?7 h+ t% c8 hvar vbCancel = 2; ( b2 V9 P$ y% x; [- `& H$ v
var vbInformation = 64;
5 z2 P3 r8 K: O4 bvar Finished=false;
% u% \6 w: f' M1 a
* ^$ y c- N3 @. H lvar WSHShell = new ActiveXObject("WScript.Shell");
1 j b+ g. A. L. g- M! p6 s7 X
' A: K/ ?3 ?. `9 c1 ovar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
Y8 ]7 k! u: _& }/ o* g* d6 t ! n: B9 \. Q3 L. K
simple.SetLicenseType("Runtime");
3 Y% i/ z0 u0 F0 k3 W 8 t7 e7 W. |6 h
try e! g* Y" D$ h8 L7 E
{
* b; d# \, l/ m* w) C- X6 |, n // Enter the path to a model file!
9 O/ R9 I6 k3 w& e simple.LoadModel("C:\\Models\\Test.spp"); ! G1 o% x5 U$ L# J% h, \5 w
}
1 a1 ]% N9 N8 c* @ V: _catch (e) 6 p& U- n+ j9 M$ }6 z
{ 1 U; \0 ?0 U/ r8 ]1 u
WScript.Echo("Could not load Model!");
* T& v& _# v, b WScript.Quit();
5 |, B& N9 N9 o} * @) _% k3 v- J* z
) {5 f4 u1 A7 U9 j: C/ Z; ptry ; D2 N1 G4 M6 ?3 s; j
{
# p6 \2 B, f! s+ G" s& c simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { % L. W2 S9 z' c
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
7 e* q$ E- h0 i+ v: j0 g' n if (r == vbCancel)
* o3 G9 I9 Q1 ?' b T+ w+ f9 C {
4 V' f f( A5 y: P5 E' F simple.CloseModel();
! y" O, }, [# k- B7 B9 q WScript.Quit();
/ Z) A" t$ D! h1 i }
; @6 f/ O: R1 N6 v( j+ \}
" Z$ |( u7 l; _% V 7 s' A+ G( H v/ g, P
simple.StartSimulation(".Models.Frame.EventController");
" O% i+ J( A2 I, Z7 o
% u$ C) T1 n, u% e2 R( fif (simple.IsSimulationRunning())
7 ^4 g5 g0 u9 ^8 f WScript.Echo("Simulation is running!"); ( \0 y7 O- P& M( {/ |, h; F
; Q( t" i3 N( ?1 l// Wait until simulation is finished 1 O, z( V2 v7 A5 R- n3 r& {
while (!Finished) WScript.Sleep(2000); ' S$ U J" s2 v
s$ _" ]% v) ?2 H
simple.CloseModel(); & u2 d, G* A" ]1 P; F. y
simple.Quit();
4 Y7 H2 D$ k- ~! _. _+ xWScript.Quit(); / m* B% Z5 F* n( b
9 m5 A4 F) q" F5 t& h6 j7 q" e* U
0 i0 Q- \! W7 cfunction RemoteControl_SimulationFinished() / f' U: [4 [6 @7 h; r% U( r
{ 2 r% T+ Y! q# _- K- A
WScript.Echo("Simulation Finished!"); |