Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

[MBS] Running 2nd copy of app as console app? (MBS Xojo Plugin Mailinglist archive)

Back to the thread list
Previous thread: [MBS] 9.0pr1
Next thread: [MBS] The Mac without a serial number


RE: [MBS] DOM classes for Mac OS X HTMLViewer   -   Giovanni
  [MBS] Running 2nd copy of app as console app?   -   Michael Diehr
   Re: [MBS] Running 2nd copy of app as console app?   -   Tim Jones
   Re: [MBS] Running 2nd copy of app as console app?   -   Christian Schmitz
    Re: [MBS] Running 2nd copy of app as console app?   -   Michael Diehr
     Re: [MBS] Running 2nd copy of app as console app?   -   Christian Schmitz
      Re: [MBS] Running 2nd copy of app as console app?   -   Michael Diehr
       Re: [MBS] Running 2nd copy of app as console app?   -   Christian Schmitz
   Re: [MBS] Running 2nd copy of app as console app?   -   Michael Diehr
    Re: [MBS] Running 2nd copy of app as console app?   -   Christian Schmitz

[MBS] Running 2nd copy of app as console app?
Date: 03.01.09 05:40 (Fri, 2 Jan 2009 20:40:04 -0800)
From: Michael Diehr
On the betas list, it was discussed that it might be possible to
execute a second copy of a realbasic application as a console app.
This "helper" app could then perform useful tasks, in a separate
preemptive thread, and communicate results back to the parent
app. This is similar to threadMBS, but has some advantages : the
2nd app is memory-protected, and can use any console-app-safe methods.

I've seen sample code for this, but for Mac OS X only.

It would be very cool if such features, for mac +win +linux could be
added to MBS. Is that possible?
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Re: [MBS] Running 2nd copy of app as console app?
Date: 03.01.09 07:07 (Fri, 02 Jan 2009 23:07:26 -0700)
From: Tim Jones
On Jan 2, 2009, at 9:40 PM, Michael Diehr wrote:

> On the betas list, it was discussed that it might be possible to
> execute a second copy of a realbasic application as a console app.
> This "helper" app could then perform useful tasks, in a separate
> preemptive thread, and communicate results back to the parent
> app. This is similar to threadMBS, but has some advantages : the
> 2nd app is memory-protected, and can use any console-app-safe methods.
>
> I've seen sample code for this, but for Mac OS X only.
>
> It would be very cool if such features, for mac +win +linux could be
> added to MBS. Is that possible?

Michael,

I think you've confused helper apps and the main app. It is quite
possible to run helper apps in Windows and Linux - The same methods
applpy. While you can use the FolderItem.Launch method if the
helpers are self contained and wither don't communicate with your
main app, or communicate through some channel such as IPC or ports.
If you want the apps to be managed by your main app and communicate
through the stdio channels, you should try an intermittent shell.

Or, have I misunderstood what you're trying to accomplish?

Tim

_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Re: [MBS] Running 2nd copy of app as console app?
Date: 03.01.09 21:58 (Sat, 3 Jan 2009 21:58:11 +0100)
From: Christian Schmitz
Michael Diehr <<email address removed>> wrote:

> On the betas list, it was discussed that it might be possible to
> execute a second copy of a realbasic application as a console app.
> This "helper" app could then perform useful tasks, in a separate
> preemptive thread, and communicate results back to the parent
> app. This is similar to threadMBS, but has some advantages : the
> 2nd app is memory-protected, and can use any console-app-safe methods.

That is easy. You just need to do the work in a console app and run it
with the shell class.

That would make a nice video to show that, but I need a good idea on
what that app should do.

Maybe with the ImageMBS class?
Process files somehow.

Gruß
Christian

-

Re: [MBS] Running 2nd copy of app as console app?
Date: 04.01.09 01:13 (Sat, 3 Jan 2009 16:13:36 -0800)
From: Michael Diehr
On Jan 3, 2009, at 12:58 PM, Christian Schmitz wrote:

> Michael Diehr <<email address removed>> wrote:
>
>> On the betas list, it was discussed that it might be possible to
>> execute a second copy of a realbasic application as a console app.
>> This "helper" app could then perform useful tasks, in a separate
>> preemptive thread, and communicate results back to the parent
>> app. This is similar to threadMBS, but has some advantages : the
>> 2nd app is memory-protected, and can use any console-app-safe
>> methods.
>
> That is easy. You just need to do the work in a console app and run it
> with the shell class.
>
> That would make a nice video to show that, but I need a good idea on
> what that app should do.
>
> Maybe with the ImageMBS class?
> Process files somehow.

In my case, I'd like to be able to do the following in a OS thread:

given a folderItem pointing to a picture (JPG, TIFF, PNG...)
load the folderItem as a picture
resize the picture (optional)
extract the RGB pixels into a memory block
return a pointer to the memoryblock containing the RGB data

I don't really care how I accomplish this, however I do have K-count
limits on my total application size, which means that including a 2nd
helper app is not ideal, since even a "hello world" app in REALbasic
is now 3+MB in size... ThreadMBS might work, but sounds like it's
very difficult to use?
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Re: [MBS] Running 2nd copy of app as console app?
Date: 04.01.09 01:42 (Sun, 4 Jan 2009 01:42:51 +0100)
From: Christian Schmitz
Michael Diehr <<email address removed>> wrote:

> return a pointer to the memoryblock containing the RGB data

That is the problem. You have independend memory.

Some apps like QuickTime Player have background shell tools they use for
specific tasks. Export a movie in QuickTime player will launch this tool
in a shell (invisible) and the player just displays the output as a
progressbar.

Gruß
Christian

-

Re: [MBS] Running 2nd copy of app as console app?
Date: 04.01.09 02:04 (Sat, 3 Jan 2009 17:04:24 -0800)
From: Michael Diehr
On Jan 3, 2009, at 4:42 PM, Christian Schmitz wrote:

> Michael Diehr <<email address removed>> wrote:
>
>> return a pointer to the memoryblock containing the RGB data
>
> That is the problem. You have independend memory.
>

What about Shared Memory?
http://developer.apple.com/documentation/Darwin/Conceptual/MacOSXNotifcationOv/AlternativestoNotification/chapter_5_section_3.html

"For general memory sharing, the easiest mechanism to use is the
mmap(2) system call. This system call allows you to map a file or
portion thereof into the memory space of your process, effectively
giving you a read-only or read-write pointer into the contents of the
file itself. By mapping a file simultaneously into multiple processes,
you can easily create shared memory between these processes. (Note
that before calling this system call, you must first create the file,
then extend it to an appropriate size.)"


_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Re: [MBS] Running 2nd copy of app as console app?
Date: 04.01.09 13:19 (Sun, 4 Jan 2009 13:19:22 +0100)
From: Christian Schmitz
Michael Diehr <<email address removed>> wrote:

> > That is the problem. You have independend memory.
>
> What about Shared Memory?

Well, you can use it :-)

Gruß
Christian

-

Re: [MBS] Running 2nd copy of app as console app?
Date: 04.01.09 01:10 (Sat, 3 Jan 2009 16:10:32 -0800)
From: Michael Diehr
On Jan 2, 2009, at 10:07 PM, Tim Jones wrote:

> On Jan 2, 2009, at 9:40 PM, Michael Diehr wrote:
>
>> On the betas list, it was discussed that it might be possible to
>> execute a second copy of a realbasic application as a console app.
>> This "helper" app could then perform useful tasks, in a separate
>> preemptive thread, and communicate results back to the parent
>> app. This is similar to threadMBS, but has some advantages : the
>> 2nd app is memory-protected, and can use any console-app-safe
>> methods.
>>
>> I've seen sample code for this, but for Mac OS X only.
>>
>> It would be very cool if such features, for mac +win +linux could be
>> added to MBS. Is that possible?
>
> Michael,
>
> I think you've confused helper apps and the main app. It is quite
> possible to run helper apps in Windows and Linux - The same methods
> applpy. While you can use the FolderItem.Launch method if the
> helpers are self contained and wither don't communicate with your
> main app, or communicate through some channel such as IPC or ports.
> If you want the apps to be managed by your main app and communicate
> through the stdio channels, you should try an intermittent shell.
>
> Or, have I misunderstood what you're trying to accomplish?
>
> Tim

My goal is to have a main app with a GUI, which then launches a 2nd
(or third or ...) copy of itself as a helper app. The helper app
should run silently in the background (no GUI, not showing up in the
application switcher) which I think is what a "console" app means?

I'm sure it's easy to write two apps that do this, but I'm wondering
if it's possible (for reasons of simplicity) to have the helper app be
actually a copy of the main app. (Reasons for this: makes a smaller
download, easier build install, etc.)
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Re: [MBS] Running 2nd copy of app as console app?
Date: 04.01.09 01:41 (Sun, 4 Jan 2009 01:41:27 +0100)
From: Christian Schmitz
Michael Diehr <<email address removed>> wrote:

> I'm sure it's easy to write two apps that do this, but I'm wondering
> if it's possible (for reasons of simplicity) to have the helper app be
> actually a copy of the main app. (Reasons for this: makes a smaller
> download, easier build install, etc.)

You can make at runtime of the app, modify it to be a background only
app (on Mac set flags like [1], on Windows do not show a window).
Than you can launch it with special parameters like a document which has
instructions.

Or with simply having the app look for a file in the app folder as a
flag.

Greetings
Christian

[1] https://www.monkeybreadsoftware.de/Freeware/MakeInvisible.shtml