Example of a JScript 6 Z1 q0 H* M: |; G: Y
var vbOKCancel = 1; 9 b- p D5 L3 r5 a, g1 S
var vbCancel = 2; / N7 A7 ^% p7 d+ p
var vbInformation = 64;
. Q6 ^8 c5 B, r* `; f5 Svar Finished=false; 5 P4 L0 _$ L1 h8 V) H
5 G- J$ [& v5 f8 Q* s+ t; ~3 Z
var WSHShell = new ActiveXObject("WScript.Shell");
* J- ?5 t; _4 E9 u' L5 m; @
2 j# T9 k4 i! [( F- Ovar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 5 m- }- h; u4 _, O0 r
Z1 ~3 w: b {1 O
simple.SetLicenseType("Runtime"); ' Q. z3 B8 Z8 ]5 G
/ h/ V1 \9 i9 {& \try 8 d/ P$ |" s6 F% i7 p+ i
{
" i4 T% n# c* @0 {1 j! i // Enter the path to a model file!
; d0 c2 \; C1 e+ @ V$ I simple.LoadModel("C:\\Models\\Test.spp");
2 r# L, p& K' V! ?0 a4 s} 8 I/ C0 o z: Q: t
catch (e) 6 |$ w) y8 Z l4 P
{
$ W. G3 ^7 T) Z WScript.Echo("Could not load Model!"); 9 a0 ^: a* | g# w& r( u
WScript.Quit(); 5 F" f0 N3 r D+ P
}
: g3 Z8 [$ w6 R- a
( |5 o3 R) h' L2 Z# s5 V: A8 btry 1 j; p) ~* z# ]
{
6 c6 v* j; O& B: Y6 W" o) I simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
/ h% R" s( [7 I0 N) U. l r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 2 v7 [0 x, }2 s5 u/ r, h1 W
if (r == vbCancel) , d0 {! e* G8 K0 [
{ ) z$ q! X: U( S O$ w# y: l
simple.CloseModel(); + a+ O; G$ c2 W
WScript.Quit();
2 S5 A. I6 l4 K0 g3 D }
9 V) a2 B/ _. t, c, c3 [+ V}
& V" D8 n: G. i6 b6 A5 T$ o j/ G
0 c" c! M. e# `8 Y4 g% W0 xsimple.StartSimulation(".Models.Frame.EventController");
5 j9 a9 W# I- n# H7 V
2 d u4 D a! w5 mif (simple.IsSimulationRunning()) I9 {) i* M) ^: t D/ Y4 _
WScript.Echo("Simulation is running!"); 4 Y+ [# ?3 R( U: ^0 h: w# ^2 R: v
4 m+ X! p& T6 ~6 W, t
// Wait until simulation is finished
# S/ C# K' Z: k! R$ D& i# B3 |9 twhile (!Finished) WScript.Sleep(2000);
" j7 ~. n1 a8 T( b$ X
: ~0 ?/ X( t* Osimple.CloseModel(); 7 ]- E1 w( s( w- [% {+ T
simple.Quit();
+ z. w8 ]" @" T0 J0 `WScript.Quit(); * D- r% @5 o- X1 w/ L
4 Q. x: N+ M$ e# G ! G7 ~: Z; B( u/ U
function RemoteControl_SimulationFinished()
3 |$ d2 I' P) {! E: J{
4 L, U2 `2 y2 d WScript.Echo("Simulation Finished!"); |