PAUSE x without any window (OOABL 10.2B04)

Posted by Stefan Marquardt on 03-May-2011 07:42

Hello,

i just hit a easy(?) problem.

How can i pause ABL for a amount x of seconds without showing any window in a batch process?

With C# i would use Thread.Sleep but this isn't allowed in OOABL (ABL.NET).

I found old p9079 but i won't like to use ocx.

/* UPDATE */

It seems to be that i hit a bug again (as so often in the past months), the trick is using WIN API (P167212,P24590).

Many KB where i am missing links, without good links it would prevent initiating discussions ...

Stefan

All Replies

Posted by Admin on 03-May-2011 08:20

if you only need down to seconds then what's wrong with plain abl?

pause 0 before hide.

pause x no-message.

Posted by Stefan Marquardt on 03-May-2011 08:40

It's wrong that it's shows an empty ABL window.

Posted by Admin on 03-May-2011 08:45

It's wrong that it's shows an empty ABL window.

DEFAULT-WINDOW:HIDDEN = TRUE .

Posted by Stefan Marquardt on 03-May-2011 08:54

It's still showing the window, only API with sleep helps (as proposed in two KB).

Posted by egarcia on 03-May-2011 09:16

What about using the -b parameter in the command line?

prowin32 -b -p program.p [additional command line parameters]

or

_progres -b -p program.p [additional command line parameters]

Posted by Stefan Marquardt on 03-May-2011 09:26

Well, -b would be another solution.

Because i am using alert-boxes and silent run in a mix i prefer the API version.

And i can test it easy within OEA or procedure editor.

Thanks for the answers.

Posted by Laura Stern on 03-May-2011 10:52

You can in fact use System.Threading.Thread:Sleep(n).  We have a restriction that you cannot create a new thread from the ABL.  (Is that why you were thinking you can't use this?)  But you can use this static method which operates on the current thread.  I was also thinking that maybe this did not work in batch mode.  But actually this works just fine.

Posted by rbf on 03-May-2011 14:30

What about "WAIT-FOR CLOSE OF THIS-PROCEDURE PAUSE n"?

Posted by Stefan Marquardt on 04-May-2011 01:27

Laura,

i didn't notice that the .NET sleep in the thread class is allowed, that's fine. (perhaps it will call inside the same api function)

I am not 100% sure, but i think that i tested it in the past with 10.2A and got an error.

Since them i never tried it, because it's a threading class.

What about updating P167212? The better solution für a GUI for .NET application should be to use this static .NET method than API.

For me - i will prefer this instead calling API direct.

Stefan

Posted by Laura Stern on 04-May-2011 10:37

I have requested that this solution be updated.  Thanks.

Posted by Lieven De Foor on 06-May-2011 08:12

PROCEDURE Sleep EXTERNAL "kernel32":U:

    DEFINE INPUT PARAMETER Milliseconds AS LONG NO-UNDO.

END PROCEDURE.

Seems to do the trick fine...

This thread is closed