Calling a livecode executable -ui from LC server and get back a result.

Mark Waddingham mark at livecode.com
Fri May 5 16:30:22 CEST 2017


Hi Malte,

On 2017-05-04 20:34, Malte Brill via use-livecode wrote:
> Hi all,
> 
> has anybody successfully done this? Especially on Windows? I would
> like to launch a livecode built application from a liveCode server
> script and get the output back (on a Server that I control) Is that
> possible? If so, how?

The problem here is a Windows 'limitation' (well design decision 
really).

Windows has two types of executable - console mode and GUI mode. 
LiveCode
is a GUI mode application, which means that it detaches from the console
and does not work in the way you would expect when run from the 
command-line.

Now, a while I back I added a wee bit of code to the engine to make it
still do something console-y on Windows: on startup it attempts to 
'AttachConsole'
which at least means the engine can access the console handles it was 
created
with when doing stdout/stderr/stdin type stuff. However, the limitation 
here
is that the process is still 'detached' from the parent and so does not
necessarily block open process or shell. (This was done IIRC as a 
request
from Roger Eller - I can't remember the exact reasons, but the code 
added
seemed to help his specific case, at least).

There's plenty of stuff about this around - Raymend Chen has plenty to
say about it. One notable article being:

  https://blogs.msdn.microsoft.com/oldnewthing/20090101-00/?p=19643

Now, one thing he links to from here is:

  
https://blogs.msdn.microsoft.com/junfeng/2004/02/06/how-to-make-an-application-as-both-gui-and-console-application/

You could try using editbin.exe to change the subsystem type 
(editbin.exe is
installed with any of the Visual Studio releases, or tools):

   EDITBIN.EXE /SUBSYSTEM:CONSOLE <livecodestandaloneexe>

Then see if this works in the way you want... It might...

Warmest Regards,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps



More information about the use-livecode mailing list