Como ejecutar un script?

HMG en Español

Moderator: Rathinagiri

Post Reply
abinfra
Posts: 68
Joined: Sat Jan 25, 2014 7:25 am
DBs Used: DBF

Como ejecutar un script?

Post by abinfra »

Buenas a todos.

Tengo un fichero.bat por el que quiero controlar si está abierto o no un programa externo de impresión y deseo saber que instrucción o código necesito programar para que se ejecute el fichero.bat

Saludos cordiales.
trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

Re: Como ejecutar un script?

Post by trmpluym »

Hi,

Code: Select all

EXECUTE FILE 'fichero.bat'
But it is better to include the whole path to the file, for example

Code: Select all

EXECUTE FILE 'C:\TEMP\fichero.bat'
Theo
abinfra
Posts: 68
Joined: Sat Jan 25, 2014 7:25 am
DBs Used: DBF

Re: Como ejecutar un script?

Post by abinfra »

Gracias trmpluym, no había utilizado este comando aún.
abinfra
Posts: 68
Joined: Sat Jan 25, 2014 7:25 am
DBs Used: DBF

Re: Como ejecutar un script?

Post by abinfra »

Hola trmpluym de nuevo.

Al compilar me da error E0030 de sintaxis en "FILE". Tengo que hacer referencia a algún "INCLUDE"?

Se le puede poner una condición a la instrucción que me has facilitado?
trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

Re: Como ejecutar un script?

Post by trmpluym »

Here a working sample (see attachement test.zip).

It is possible to specify parameters, for example :

EXECUTE FILE "NOTEPAD.EXE" PARAMETERS cFileName
Attachments
test.zip
(1.47 MiB) Downloaded 229 times
abinfra
Posts: 68
Joined: Sat Jan 25, 2014 7:25 am
DBs Used: DBF

Re: Como ejecutar un script?

Post by abinfra »

La diferencia está en que yo no tengo puesta la siguiente instrucción:
#include "hmg.ch"

Pero si la pongo me da el error:
Error F0029 Can't open #include file 'hmg.ch' --> ¿será porque yo trabajo en modo consola?
trmpluym
Posts: 303
Joined: Tue Jul 15, 2014 6:52 pm
Location: The Netherlands

Re: Como ejecutar un script?

Post by trmpluym »

The file hmg.ch is used in almost avery HMG sample (see c:\hmg.3.4.4\SAMPLES).

In the latest HMG release the file is located in c:\hmg.3.4.4\INCLUDE\hmg.ch
abinfra
Posts: 68
Joined: Sat Jan 25, 2014 7:25 am
DBs Used: DBF

Re: Como ejecutar un script?

Post by abinfra »

Hola trmpluym, gracias por tu interés en ayudarme.

EXECUTE FILE necesita #include "hmg.ch" que lo tengo en C:\HMG.3.3.1\INCLUDE, pero como compilo en modo CONSOLA, porque vengo de CLIPPER, hay código de HMG que no puedo usar.

He probado con RUN y si me funciona.

¿Donde puedo encontrar información de HMG sobre el código a usar en modo consola?
User avatar
mustafa
Posts: 1158
Joined: Fri Mar 20, 2009 11:38 am
DBs Used: DBF
Location: Alicante - Spain
Contact:

Re: Como ejecutar un script?

Post by mustafa »

Hola abinfra:

Mira este post:
http://www.hmgforum.com/viewtopic.php?f ... ole#p52690

El código más resumido para una demo

Code: Select all


REQUEST HB_GT_WIN_DEFAULT

#include "hmg.ch"
#include "Inkey.ch"

Function Main
 
       LOCAL nChoice := 1
       SET MESSAGE TO 23 CENTER
       SET WRAP ON
       SET EVENTMASK TO INKEY_ALL
	     setcolor( "N/W,N/GR*,,,N/W*" ) 
       SetMode( 35,95 )    
	     CLS
  DO WHILE (LASTKEY() != K_ESC) 
        @ 1,5 say "PageScripts32 Print Preview Console Demo" // COLOR W/BR+
        @ 6, 30 PROMPT "PS32 Demo"  MESSAGE "Print Preview to print windows printer"
        @ 8, 30 PROMPT "Quit" MESSAGE "Return to DOS"
        MENU TO nChoice
        DO CASE
        CASE nChoice = 1
         * OnInit()   
        CASE nChoice = 2
           QUIT
        ENDCASE
   ENDDO

 Return NIL

Un saludo
Mustafa
abinfra
Posts: 68
Joined: Sat Jan 25, 2014 7:25 am
DBs Used: DBF

Re: Como ejecutar un script?

Post by abinfra »

Gracias Mustafa.
Saludos.
Post Reply