Problem with RUN command

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
radohabjan
Posts: 99
Joined: Mon Nov 30, 2009 7:17 am
Location: Slovenia
Contact:

Problem with RUN command

Post by radohabjan »

Hello Friends,

recently I upgrade HMG from 3.0.40 to 3.0.46 ( every 5-6 version is OK for me ).
In this release I have problem with RUN command, which doesn't work.

ukaz="copy print.htm print1.htm"
run(ukaz)

I think that problem is in Harbour 3.2.
Did I missed something ?

br Rado
User avatar
danielmaximiliano
Posts: 2763
Joined: Fri Apr 09, 2010 4:53 pm
DBs Used: DBF
Location: Argentina
Contact:

Re: Problem with RUN command

Post by danielmaximiliano »

Try : EXECUTE FILE "file" PARAMETERS "parameters"
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Telegram invitation https://t.me/HMGWorkspace
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

Re: Problem with RUN command

Post by mol »

This problem was described last time on harbour google list. Ihave no access to this list now, I'll search it tomorrow and post solution.

Upps!
I found it:

1. RUN

RUN ("arquivo.bat")
Opens the console window but don't executes.
I am using GTWVT, and the console window close in less than 1 second,
can't read the window messages.
Solve including run.c from harbour 3.0 in my application.


It's pretty bad hack. If you want to run the shell
command processor, f.e. to run batch file like above,
either call it manually:

hb_run( GetEnv( "COMSPEC" ) + " /c arquivo.bat" )

Or use f.e. RunShell() from hbxpp.hbc:

RunShell( "arquivo.bat" )

-- Viktor
radohabjan
Posts: 99
Joined: Mon Nov 30, 2009 7:17 am
Location: Slovenia
Contact:

Re: Problem with RUN command

Post by radohabjan »

Thanks Marek,

hb_run works fine
I still have a lot of old commands in programms such as
run()
or
! mode com1: 9600,n,8,1

and it's a problem, when something doesn't work after 25 years.
Don't touch, if it works.

br Rado
User avatar
Jairo Maia
Posts: 53
Joined: Sun Jul 17, 2011 1:47 pm
Location: Campinas - SP - Brazil

Re: Problem with RUN command

Post by Jairo Maia »

Hello Rado,

Put this function in to your app source and see if it work:

Code: Select all

/*
 * Harbour Project source code:
 * __RUN function
 *
 * Copyright 1999 Eddie Runia <eddie@runia.com>
 * www - http://harbour-project.org
 *
*/

#pragma BeginDump

#include "hbapi.h"
#include "hbapierr.h"
#include "hbapigt.h"
#include "hbapiitm.h"
#include "hbapifs.h"

/* TOFIX: The screen buffer handling is not right for all platforms (Windows)
          The output of the launched (DOS?) app is not visible. */

HB_FUNC( __RUN )
{
   const char * pszCommand = hb_parc( 1 );

   if( pszCommand && hb_gtSuspend() == 0 )
   {
#if defined( HB_OS_WIN_CE )
      hb_fsProcessRun( pszCommand, NULL, 0, NULL, NULL, NULL, NULL, HB_FALSE );
#else
      char * pszFree = NULL;

      if( system( hb_osEncodeCP( pszCommand, &pszFree, NULL ) ) != 0 ) {}

      if( pszFree )
         hb_xfree( pszFree );
#endif

      if( hb_gtResume() != 0 )
      {
         /* an error should be generated here !! Something like */
         /* hb_errRT_BASE_Ext1( EG_GTRESUME, 6002, NULL, HB_ERR_FUNCNAME, 0, EF_CANDEFAULT ); */
      }
   }
}

#pragma EndDump
Last edited by Jairo Maia on Tue Nov 13, 2012 2:02 pm, edited 1 time in total.
User avatar
danielmaximiliano
Posts: 2763
Joined: Fri Apr 09, 2010 4:53 pm
DBs Used: DBF
Location: Argentina
Contact:

Re: Problem with RUN command

Post by danielmaximiliano »

radohabjan wrote:Thanks Marek,

! mode com1: 9600,n,8,1

and it's a problem, when something doesn't work after 25 years.
Don't touch, if it works.

br Rado
Hi Rado :
Try Bartools, in c:\minigui\samples\advance\bartools
my aplication with barcode work fine.
File: BarTools.prg
Contributors: "SerialComm" By Panagiotis Siampanis <panosavlida@yahoo.gr>
"BarTools" By Pierpaolo Martinello <pier.martinello[at]alice.it>
Description: Barcode Reader with serial input for MiniGUI
Status: Public Domain
or HBCOMM compatibility library.
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
Telegram invitation https://t.me/HMGWorkspace
Post Reply