Example of a JScript
" Q$ h9 \) |/ w5 v9 N1 Zvar vbOKCancel = 1;
1 y1 q) K5 e, F) J' z, i# Tvar vbCancel = 2; 5 Y" M0 u9 q( L& z$ u. n
var vbInformation = 64;
, c! Q7 H8 U4 ?: S8 U* ^var Finished=false; + o% J- M3 ~+ o6 f+ A* Y
' P5 F6 o; h$ r+ z. Q5 J
var WSHShell = new ActiveXObject("WScript.Shell");
: k% L4 @, d; Q- ]; ]$ Y 0 l8 N* C, C4 m4 {" W$ h( m8 {7 B# }
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
" i" G8 V# @+ n) K Q
" ~- w) j q* t" ~' isimple.SetLicenseType("Runtime");
- q/ U. A5 s# k
9 Y9 F2 ^0 r& h$ d6 t e. y6 F; utry ; Q+ `5 ~6 d1 |* J$ L
{ 0 L: D$ A/ y8 o1 ]! J5 d
// Enter the path to a model file! + H3 {! Y, c# o
simple.LoadModel("C:\\Models\\Test.spp"); * B) H2 i' K0 u5 r
} * {; ` K6 Q$ M: S
catch (e)
6 E+ x8 X; Z" D- Y7 `5 D{
9 Q1 V& @/ C. o; L% Q7 F WScript.Echo("Could not load Model!"); ! x- Y; v3 x- V& P( e& Q1 [
WScript.Quit(); % M1 d, R( z* j
} S C0 B6 `3 S7 m; F) O
7 n6 f! Z0 T* S- c6 F/ i) j
try $ k8 I: ^: {5 E/ `/ b
{
2 m4 O) w' Q! C) M4 L ?$ ]3 ]5 U simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ! E2 q( M! _4 ]+ t
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); * r8 h- Y5 ^# D1 v4 p' D
if (r == vbCancel) # g4 K/ ~& L5 x( g* q1 J
{ * q+ l( j' N- h
simple.CloseModel(); / w# i( s+ Y/ e. U ?/ `7 f
WScript.Quit(); & K t: D3 h* D9 E4 }
} ! `5 y; w0 W5 B8 @$ X: D
}
" T7 G3 n% B5 r" Q ? L7 r$ f$ ]! S) p3 q3 {
simple.StartSimulation(".Models.Frame.EventController");
. M" R ~" N! V
0 x, M( f1 |2 J1 J3 F/ D% gif (simple.IsSimulationRunning()) % d$ [3 ?& Q" `! Z1 q
WScript.Echo("Simulation is running!");
* ]2 p* w/ F2 [9 A+ ~( B
9 L+ g$ g; S* Z( x# Z6 t! n: m// Wait until simulation is finished
8 {" F; L$ s6 owhile (!Finished) WScript.Sleep(2000);
# {' r8 {: \3 p+ A( w! a0 v) Q
! ^+ Z' e4 ^ V* c' U. w& Tsimple.CloseModel();
( f1 ^# T& q5 f, V% X8 D# @+ b5 ?' xsimple.Quit(); $ Q8 m! Y9 w1 i; ]- q
WScript.Quit();
; m" m; u/ c* [0 w1 J
, Y! w% m d2 \
* |/ x/ f1 [$ a; t4 N) mfunction RemoteControl_SimulationFinished() 3 ]) i+ s, ?0 G1 N% R8 K; o( q+ E
{ $ p, y0 S0 I0 R% g4 U
WScript.Echo("Simulation Finished!"); |