Example of a JScript 7 ]7 U3 ] G% W5 u8 k8 Q3 K
var vbOKCancel = 1;
1 {. n* {( O( `9 F2 tvar vbCancel = 2; + ~& I9 B8 ?: }
var vbInformation = 64; " O! u7 ~- L) I h+ y* r9 h% ~
var Finished=false;
% @$ r3 K) q. m- i
* ?- r8 s+ m9 [+ M6 Vvar WSHShell = new ActiveXObject("WScript.Shell");
+ [2 {2 Y* E) | - C3 r, L0 c$ o8 ^/ `, c7 k
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
. y H/ ?, j/ ?3 V2 W8 n& j0 P7 I" ? * V! E/ ?' e( c# Z: i! U( q
simple.SetLicenseType("Runtime");
8 R- S: T, U# I1 c( v
0 }$ w6 v: c& s+ z# D3 Utry ; k7 t) \- V2 q8 ?5 w4 h/ D. p( N
{ " G4 B; ^* S. ?
// Enter the path to a model file!
8 w0 _4 a& Z1 s+ c simple.LoadModel("C:\\Models\\Test.spp");
/ Q: v# _1 [) S} , W) V8 S5 ]; Z" s+ f3 q/ s
catch (e) : l: s, k6 R* P" v! M
{ 0 h3 ~0 S1 i3 O2 d- W
WScript.Echo("Could not load Model!");
/ K4 R. i6 H; K3 p WScript.Quit();
y6 n1 ?" c& \! z8 |1 S}
8 D5 O6 G1 T2 F, h ) F2 M( \( V* @8 @ `( b! n3 y
try / H8 N# X- J1 j, O/ W& o
{ / H; ]. L$ Q% @/ }* a
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
1 ^6 n. ~$ Y2 D& q" i0 B$ w r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
9 k4 v% L' t( i0 T2 Y2 T if (r == vbCancel) 5 I/ s0 B! O* Z5 Y
{ ) @4 X& ~0 ^7 H1 s4 R
simple.CloseModel();
$ O4 ^3 D! [- N& i9 g% P. U' ? WScript.Quit(); . ]! g" g6 M% f4 `- t& ^
}
; g! P7 z( Q2 {2 b8 w} - d7 t1 U4 u- j% D
, H1 `8 Y2 I2 B7 J3 e/ c1 `
simple.StartSimulation(".Models.Frame.EventController"); ' c |( S+ @* I4 \8 N
6 k5 e# g0 d$ C2 y% ~' L
if (simple.IsSimulationRunning()) u/ s7 b( o M" D8 c) o
WScript.Echo("Simulation is running!"); 2 ~, I2 g+ ]. V; m
3 v' q4 F% b D/ c! ^8 y
// Wait until simulation is finished
) N. ]3 a6 t4 `7 V1 A6 { bwhile (!Finished) WScript.Sleep(2000); ( K5 U+ z( L2 j/ W Q2 j q: t5 m8 P
: ?" h$ x; c7 v
simple.CloseModel(); 7 H: J. P0 n5 Y
simple.Quit(); ; ?; X+ C& Z: D+ i+ J" Y( N: D
WScript.Quit(); ; Y/ Z! U& H' C8 r! H+ g; G: |( p+ {9 [
( _; W7 _& z. |% i6 P& N( X# W
& b" ]/ J( k6 r4 y, n' Q0 tfunction RemoteControl_SimulationFinished() ' @. B) L |" h/ E& R" u
{
! M, e% K/ R1 [- ? WScript.Echo("Simulation Finished!"); |