Many thanks for the tip about using additional flags in Info.plist. I =
shall
look further in that direction.
In our application, we use the first process to set up a simulation, and =
the
second process to execute it. The point of using two processes is that =
the
execution process can (in some awful circumstances) enter an endless =
loop,
in which case the only possible recovery is to kill the second process =
using
UI elements in the first. That way the first process is unaffected, and =
the
user can correct the error and re-start the simulation. (Don't blame me =
for
the design; I'm only porting it!) Both processes display a variety of
windows.
I suppose my query is really about making our use of two processes =
invisible
to the user, as it is on *nix systems or Windows. It should appear as a
single application bundle, with one icon in the Finder, one icon in the =
Dock
and so on. One implication of these constraints, I suspect, is that we =
need
to use a single Info.plist. Are there any other approaches? Is passing =
the
Carbon process number around (as discussed earlier in the thread) a
legitimate thing to do in these circumstances?
Thanks again for your input.
Kind regards,
Alastair=20
-----Original Message-----
From: tcl-mac-admin@...
[mailto:tcl-mac-admin@...] On Behalf Of Wout Mertens
Sent: Friday, January 21, 2005 2:27 PM
To: Alastair Davies
Cc: 'G=FCnther Enthaler' ; tcl-mac@...
Subject: Re: [MACTCL] POSIX applications interacting with Wish Shell
You could make the second application a background app? You need to set =
LSBackGroundOnly or something like that in your Info.plist.
Why do you want to use 2 Wish shells? Is the second shell supposed to =20
open windows as well?
Cheers,
Wout.
On 18 Jan 2005, at 19:29, Alastair Davies wrote:
>
> Hello G=FCnther, Wout and others,
>
> I have been reading this thread with interest, but I am struggling to =
> apply
> it to my own problem. I would like to use one Wish to start a second =
> Wish,
> and communicate between the two using a pipe. I would like the second =
=20
> Wish
> *not* to appear in the Dock. (The icon of the first Wish is =20
> sufficient for
> my purpose.) Am I correct in deducing from your exchange that the =20
> crucial
> aspect to this is that the two Wish should share the same process =20
> number?
>
> My Tcl command looks something like this and I can write to the =20
> resulting
> file handle using puts:
>
> open {|../MacOS/Wish\ Shell} WRONLY
>
> I have not succeeded in sharing the process number however. Using, =
for
> clarity, exec rather than open I tried the following sequence in the =20
> TkAqua
> Wish. After the second command, Wish opens successfully and I just =20
> close it
> down and try the third command. In my case, $argv is equal to
> -psn_0_18874369. The third command generates the error shown.
>
> cd /Applications/Utilities/Wish\ Shell.app/Contents/Resources
> exec "../MacOS/Wish Shell"
> exec "../MacOS/Wish Shell" $argv
>
> RegisterProcess failed (error =3D -2805)
>
>> From your trials (and presumably errors!) in your own project, can =20
>> you shed
> any light on my efforts?
>
> Many thanks,
> Alastair
>
>
> -----Original Message-----
> From: G=FCnther Enthaler
> Sent: Wednesday, October 20, 2004 1:19 PM
> To: Wout Mertens
> Cc: tcl-mac@...
> Subject: Re: [MACTCL] POSIX applications interacting with Wish Shell
>
>
> Hi Wout,
>
> Thanks for the shell goodness, I've implemented it and it works fine, =
> and no
> doubt, in more robust fashion :)
>
> To fix the menu name, I copied the Wish Shell app into =20
> Calc/Contents/Plugins
> (for want of a better location - I'm not sure Resources is a good =20
> place),
> changed the copy's Info.plist's CFBundleName to "Calc" and told the =20
> wish
> script to exec "../Plugins/Wish Shell/Contents/MacOS/Wish Shell" =20
> "$WISHPSN"
> "$@", et voil=E0, the application has the right name.
> The beauty of this is that it still doesn't require any bespoke =20
> MacOSX/Aqua
> code.
>
> Regards,
> G=FCnther
>
>
>> From: Wout Mertens <wmertens@...>
>> Date: Wed, 20 Oct 2004 13:02:37 +0200
>> To: G=FCnther Enthaler <genthaler@...>
>> Cc: tcl-mac@...
>> Subject: Re: [MACTCL] POSIX applications interacting with Wish Shell
>>
>> Great!
>>
>> Some suggestions:
>> - put the $@ between quotes: "$@" so that arguments with spaces are
>> passed correctly
>> - exec /usr/bin/wish so that you clear up the process table :)
>> - cd $bundle first, and do export PATH=3D"`pwd`:$PATH" afterwards. =
This
>> cleans up the path name.
>>
>> As for the name, you can name wish something else and the menu might
>> pick that up, and I saw something about the special menu name "ap" or
>> something like that.
>>
>> Cheers,
>>
>> Wout.
>>
>> On 20 Oct 2004, at 10:41, G=FCnther Enthaler wrote:
>>
>>> Wout,
>>>
>>> Sorry for the delay - Real Life intervened :)
>>>
>>> Using your suggestions wasn't enough; the background problem kept
>>> happening.
>>> I found that the problem was that the wish that was forked didn't =
get
>>> the
>>> -psn argument that the original application received.
>>>
>>>
>>> So the solution is to use a slightly modified version of your script =
=20
>>> to
>>> capture the -psn, include the bundle's path in PATH, have a script
>>> called
>>> wish that calls /usr/bin/wish with the -psn
>>>
>>> In Calc.app/Contents/MacOS/Calc
>>>
>>> #!/bin/sh
>>> # Find the bundle path
>>> bundle=3D"`dirname "$0"`"
>>> case "$bundle" in /*) : ;; *) bundle=3D"$PWD/$bundle" ;; esac
>>> export PATH=3D$bundle:$PATH
>>> cd $bundle
>>> export WISHPSN=3D$1
>>> shift 1
>>> exec "$bundle/Calc.exe" $@
>>>
>>> Somewhere in the bowels of Calc.exe
>>>
>>> pid =3D vfork();
>>> <snip>
>>> execl("wish", "wish", NULL);
>>>
>>> In Calc.app/Contents/MacOS/wish
>>>
>>> #!/bin/sh
>>> echo $WISHPSN
>>> /usr/bin/wish $WISHPSN $@
>>>
>>> So now I have a single icon, non-bouncing icon, mouse-responsive, =20
>>> Aqua
>>> GUI
>>> application. And the same application (without the app bundle =20
>>> wrapper)
>>> should also work in an X11 environment.
>>>
>>> Of course, now I have to work how to change the menu application =
name
>>> etc...
>>>
>>>
>>> Regards,
>>> G=FCnther
>>>
>>>
>>>> From: Wout Mertens <wmertens@...>
>>>> Date: Wed, 06 Oct 2004 17:07:34 +0200
>>>> To: G=FCnther Enthaler <genthaler@...>
>>>> Cc: "tcl-mac@..." <tcl-mac@...>
>>>> Subject: Re: [MACTCL] POSIX applications interacting with Wish =
Shell
>>>>
>>>> Just tell curry to use the symlinked wish. Then the startup-bounce
>>>> will
>>>> stop, since wish is from the same app bundle that Dock is trying to
>>>> start.
>>>>
>>>> Wout.
>>>>
>>>> On 06 Oct 2004, at 16:19, G=FCnther Enthaler wrote:
>>>>
>>>>> This would work if I were generating a static script for Tk to
>>>>> render.
>>>>> In
>>>>> which case I would just clone the Wish Shell, rename my script to
>>>>> AppMain.tcl and stick it in Resources as the doco recommends.
>>>>>
>>>>> In Curry's case though, wish is acting as a graphics server, in =20
>>>>> much
>>>>> the
>>>>> same way as say Tkinter does the job for Python. In the case of
>>>>> Tkinter
>>>>> though, Tk is dyld'ed into the currently running application =
rather
>>>>> than
>>>>> forking a wish i.e. no separate process.
>>>>>
>>>>> It's the separate process thing that's breaking the MacOSX
>>>>> application
>>>>> bundle mechanism, as far as I can tell. What may be needed is to =20
>>>>> tell
>>>>> the
>>>>> Finder to send AppleEvents to the wish child process directly; but
>>>>> I've
>>>>> really no idea.
>>>>>
>>>>> Regards,
>>>>> G=FCnther
>>>>>
>>>>>
>>>>>> From: Wout Mertens <wmertens@...>
>>>>>> Date: Tue, 05 Oct 2004 17:11:41 +0200
>>>>>> To: G=FCnther Enthaler <genthaler@...>
>>>>>> Cc: "tcl-mac@..." =20
>>>>>> <tcl-mac@...>
>>>>>> Subject: Re: [MACTCL] POSIX applications interacting with Wish =20
>>>>>> Shell
>>>>>>
>>>>>> Try making the following setup:
>>>>>> foo.app/
>>>>>> Contents/
>>>>>> MacOS/
>>>>>> wish -> /Library/Frameworks/Tk.framework/Resources/Wish
>>>>>> Shell.app/Contents/MacOS/Wish Shell
>>>>>> wrapme
>>>>>> Resources/
>>>>>> myscript
>>>>>> all_the_rest
>>>>>>
>>>>>> wrapme should be something like
>>>>>> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20
>>>>>> =3D=3D
>>>>>> =3D=3D
>>>>>> =3D=3D
>>>>>> =3D=3D=3D
>>>>>> #!/bin/sh
>>>>>> # Find the bundle path
>>>>>> bundle=3D"`dirname "$0"`"
>>>>>> case "$bundle" in /*) : ;; *) bundle=3D"$PWD/$bundle" ;; esac
>>>>>> exec "$bundle/wish" "$bundle/../Resources/myscript" "$@"
>>>>>> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20
>>>>>> =3D=3D
>>>>>> =3D=3D
>>>>>> =3D=3D
>>>>>> =3D=3D=3D
>>>>>>
>>>>>> In this case, it's for wrapping a script, Curry should just call =
>>>>>> the
>>>>>> wish in that MacOS directory. Make sure that the bundle =
executable
>>>>>> is
>>>>>> wrapme or curry. The Dock will display the package name and icon,
>>>>>> and
>>>>>> the menu depends on tk. You can set apple.mw I believe to =
overload
>>>>>> the
>>>>>> menu.
>>>>>>
>>>>>> It could be I'm being complicated and you should just do the
>>>>>> apple.mw
>>>>>> thing. The wrapper is needed for perl at least.
>>>>>>
>>>>>> There were some mails about overloading the menu last week.
>>>>>>
>>>>>> Cheers,
>>>>>>
>>>>>> Wout.
>>>>>>
>>>>>> On 05 Oct 2004, at 15:40, G=FCnther Enthaler wrote:
>>>>>>
>>>>>>> Hi all,
>>>>>>>
>>>>>>> I'm trying to get a functional logic programming language called
>>>>>>> Curry
>>>>>>> to
>>>>>>> work in an integrated way with Aqua. The Curry compiler compiles
>>>>>>> down
>>>>>>> to
>>>>>>> POSIX C, and (in an X11 environment, at least) forks a wish and
>>>>>>> communicates
>>>>>>> with the child wish process via pipes.
>>>>>>>
>>>>>>> This all works perfectly for me on OS X via X11, but I'm trying =
>>>>>>> to
>>>>>>> use
>>>>>>> TclTkAqua.
>>>>>>>
>>>>>>> If I invoke the command line Curry program from Terminal against
>>>>>>> Wish
>>>>>>> Shell.app, it fires up the Wish Shell and everything works
>>>>>>> perfectly
>>>>>>> -
>>>>>>> except that the Wish Shell owns the menus & windows.
>>>>>>>
>>>>>>> If I package the command line up in an app bundle, then two =
icons
>>>>>>> appear in
>>>>>>> the Dock and the Wish Shell still owns the windows and menus and
>>>>>>> the
>>>>>>> other
>>>>>>> icon just bounces.
>>>>>>>
>>>>>>> If I copy the Wish Shell into the app bundle, then only one icon
>>>>>>> appears in
>>>>>>> the dock, but the window stays in the background, and the =
console
>>>>>>> displays
>>>>>>> the error SetFrontProcess failed 606.
>>>>>>>
>>>>>>> Any suggestions?
>>>>>>>
>>>>>>>
>>>>>>> Regards,
>>>>>>> G=FCnther
>>>>>>>
>>>>>>>
-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
Tcl-mac mailing list
Tcl-mac@...
https://lists.sourceforge.net/lists/listinfo/tcl-mac

Community

Help

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

I agree to receive quotes, newsletters and other information from sourceforge.net and its partners regarding IT services and products. I understand that I can withdraw my consent at any time. Please refer to our Privacy Policy or Contact Us for more details