Call executable from 4GL

Thanks for all the detail Adam. I think I'll be able to figure it out with this.

Eric
--- In vantage@yahoogroups.com, "saberlogic_aellis" <aellis@...> wrote:
>
> Eric,
>
> Let me give you a bit of a more functional example. As a side, this actually might be useful to anybody out there that uses Logicity Pro. It is basically a thing that allows you to auto-email your invoices but could be extended to any document type. We are still working on this and some day may bundle it up as a package for resale but you all are free to use what I have uploaded here. If this is appropriate to put in the Files section maybe a moderator can let me know and I'll put it there instead:
>
> Server: ftp.saberlogic.com
> User: vantageug
> Password: password
>
> Hope this helps - I figure your underlying issue might have just been something with the way the code got pasted into the forum here so look at the .P files and that should get you going in the right direction.
>
> Regards,
> Adam
>
> --- In vantage@yahoogroups.com, "ericzuerche" <ezuercher@> wrote:
> >
> > Hmm, I must be missing something. When I use this code in a method directive I get an error message relating to not being able to nest a procedure inside a directive, and when I put it in a P file I get a 4GL Stop error when I try to Validate it. The P file runs fine when I remove the ShellExecuteA stuff so it must be related to that function.
> >
> > Any ideas for me?
> >
> > Thanks
> > Eric
> >
> >
> >
> > --- In vantage@yahoogroups.com, "saberlogic_aellis" <aellis@> wrote:
> > >
> > > Here is a snippet I had to do that:
> > >
> > > DEF VAR lReturnCode AS INTEGER NO-UNDO.
> > > DEF VAR sNullString AS CHARACTER NO-UNDO.
> > >
> > > PROCEDURE ShellExecuteA EXTERNAL "SHELL32.DLL":
> > >
> > > DEF INPUT PARAM hWnd AS LONG.
> > > DEF INPUT PARAM lpOperation AS CHARACTER.
> > > DEF INPUT PARAM lpFile AS CHARACTER.
> > > DEF INPUT PARAM lpParameters AS CHARACTER.
> > > DEF INPUT PARAM lpDirectory AS CHARACTER.
> > > DEF INPUT PARAM nShowCmd AS LONG.
> > > DEF RETURN PARAM lStatusCode AS LONG.
> > >
> > > END PROCEDURE.
> > >
> > >
> > > RUN ShellExecuteA ( INPUT 0,
> > > INPUT sNullString,
> > > INPUT "D:\4GL Files\Tests\Test.xls", /*The application or file that you wish to run*/
> > > INPUT sNullString, /*command line parameters to be passed with it*/
> > > INPUT sNullString,
> > > INPUT 1,
> > > OUTPUT lReturnCode).
> > >
> > > /* The below code isn't really necessary, just there for testing through the progress application
> > >
> > > IF lReturnCode <= 32 THEN
> > > MESSAGE "Application Failed: " lReturnCode VIEW-AS ALERT-BOX.*/
> > >
> > >
> > > --- In vantage@yahoogroups.com, "ericzuerche" <ezuercher@> wrote:
> > > >
> > > > Does anyone know how to run an executable directly from 4GL/ABL code in a method directive? Similar to using Shell in vbnet.
> > > >
> > > > Eric
> > > >
> > >
> >
>
Does anyone know how to run an executable directly from 4GL/ABL code in a method directive? Similar to using Shell in vbnet.

Eric
Here is a snippet I had to do that:

DEF VAR lReturnCode AS INTEGER NO-UNDO.
DEF VAR sNullString AS CHARACTER NO-UNDO.

PROCEDURE ShellExecuteA EXTERNAL "SHELL32.DLL":

DEF INPUT PARAM hWnd AS LONG.
DEF INPUT PARAM lpOperation AS CHARACTER.
DEF INPUT PARAM lpFile AS CHARACTER.
DEF INPUT PARAM lpParameters AS CHARACTER.
DEF INPUT PARAM lpDirectory AS CHARACTER.
DEF INPUT PARAM nShowCmd AS LONG.
DEF RETURN PARAM lStatusCode AS LONG.

END PROCEDURE.


RUN ShellExecuteA ( INPUT 0,
INPUT sNullString,
INPUT "D:\4GL Files\Tests\Test.xls", /*The application or file that you wish to run*/
INPUT sNullString, /*command line parameters to be passed with it*/
INPUT sNullString,
INPUT 1,
OUTPUT lReturnCode).

/* The below code isn't really necessary, just there for testing through the progress application

IF lReturnCode <= 32 THEN
MESSAGE "Application Failed: " lReturnCode VIEW-AS ALERT-BOX.*/


--- In vantage@yahoogroups.com, "ericzuerche" <ezuercher@...> wrote:
>
> Does anyone know how to run an executable directly from 4GL/ABL code in a method directive? Similar to using Shell in vbnet.
>
> Eric
>
Hmm, I must be missing something. When I use this code in a method directive I get an error message relating to not being able to nest a procedure inside a directive, and when I put it in a P file I get a 4GL Stop error when I try to Validate it. The P file runs fine when I remove the ShellExecuteA stuff so it must be related to that function.

Any ideas for me?

Thanks
Eric



--- In vantage@yahoogroups.com, "saberlogic_aellis" <aellis@...> wrote:
>
> Here is a snippet I had to do that:
>
> DEF VAR lReturnCode AS INTEGER NO-UNDO.
> DEF VAR sNullString AS CHARACTER NO-UNDO.
>
> PROCEDURE ShellExecuteA EXTERNAL "SHELL32.DLL":
>
> DEF INPUT PARAM hWnd AS LONG.
> DEF INPUT PARAM lpOperation AS CHARACTER.
> DEF INPUT PARAM lpFile AS CHARACTER.
> DEF INPUT PARAM lpParameters AS CHARACTER.
> DEF INPUT PARAM lpDirectory AS CHARACTER.
> DEF INPUT PARAM nShowCmd AS LONG.
> DEF RETURN PARAM lStatusCode AS LONG.
>
> END PROCEDURE.
>
>
> RUN ShellExecuteA ( INPUT 0,
> INPUT sNullString,
> INPUT "D:\4GL Files\Tests\Test.xls", /*The application or file that you wish to run*/
> INPUT sNullString, /*command line parameters to be passed with it*/
> INPUT sNullString,
> INPUT 1,
> OUTPUT lReturnCode).
>
> /* The below code isn't really necessary, just there for testing through the progress application
>
> IF lReturnCode <= 32 THEN
> MESSAGE "Application Failed: " lReturnCode VIEW-AS ALERT-BOX.*/
>
>
> --- In vantage@yahoogroups.com, "ericzuerche" <ezuercher@> wrote:
> >
> > Does anyone know how to run an executable directly from 4GL/ABL code in a method directive? Similar to using Shell in vbnet.
> >
> > Eric
> >
>
Eric,

Let me give you a bit of a more functional example. As a side, this actually might be useful to anybody out there that uses Logicity Pro. It is basically a thing that allows you to auto-email your invoices but could be extended to any document type. We are still working on this and some day may bundle it up as a package for resale but you all are free to use what I have uploaded here. If this is appropriate to put in the Files section maybe a moderator can let me know and I'll put it there instead:

Server: ftp.saberlogic.com
User: vantageug
Password: password

Hope this helps - I figure your underlying issue might have just been something with the way the code got pasted into the forum here so look at the .P files and that should get you going in the right direction.

Regards,
Adam

--- In vantage@yahoogroups.com, "ericzuerche" <ezuercher@...> wrote:
>
> Hmm, I must be missing something. When I use this code in a method directive I get an error message relating to not being able to nest a procedure inside a directive, and when I put it in a P file I get a 4GL Stop error when I try to Validate it. The P file runs fine when I remove the ShellExecuteA stuff so it must be related to that function.
>
> Any ideas for me?
>
> Thanks
> Eric
>
>
>
> --- In vantage@yahoogroups.com, "saberlogic_aellis" <aellis@> wrote:
> >
> > Here is a snippet I had to do that:
> >
> > DEF VAR lReturnCode AS INTEGER NO-UNDO.
> > DEF VAR sNullString AS CHARACTER NO-UNDO.
> >
> > PROCEDURE ShellExecuteA EXTERNAL "SHELL32.DLL":
> >
> > DEF INPUT PARAM hWnd AS LONG.
> > DEF INPUT PARAM lpOperation AS CHARACTER.
> > DEF INPUT PARAM lpFile AS CHARACTER.
> > DEF INPUT PARAM lpParameters AS CHARACTER.
> > DEF INPUT PARAM lpDirectory AS CHARACTER.
> > DEF INPUT PARAM nShowCmd AS LONG.
> > DEF RETURN PARAM lStatusCode AS LONG.
> >
> > END PROCEDURE.
> >
> >
> > RUN ShellExecuteA ( INPUT 0,
> > INPUT sNullString,
> > INPUT "D:\4GL Files\Tests\Test.xls", /*The application or file that you wish to run*/
> > INPUT sNullString, /*command line parameters to be passed with it*/
> > INPUT sNullString,
> > INPUT 1,
> > OUTPUT lReturnCode).
> >
> > /* The below code isn't really necessary, just there for testing through the progress application
> >
> > IF lReturnCode <= 32 THEN
> > MESSAGE "Application Failed: " lReturnCode VIEW-AS ALERT-BOX.*/
> >
> >
> > --- In vantage@yahoogroups.com, "ericzuerche" <ezuercher@> wrote:
> > >
> > > Does anyone know how to run an executable directly from 4GL/ABL code in a method directive? Similar to using Shell in vbnet.
> > >
> > > Eric
> > >
> >
>