From: Jim I. <ji...@ap...> - 2004-03-26 00:30:03
|
Does gvim use the "open" command, or is it a bit of C code? The shell command "open" does do what you want, and using LaunchServices it is just a few lines of C code. But the Launch Services semantics are not at all the same as the exec semantics: it doesn't support pipes, redirect, etc... So we can't use that for the exec command. And "open" doesn't pass along command line arguments, so we can't use that in the /usr/bin/wish command. Jim On Mar 25, 2004, at 2:41 PM, Michael McFarlane wrote: > Thanks for looking into this Jim. A good example of an app that works > the > way I'm talking about is gvim, which is a command line way of > activating the > Vim application in the Finder. The gvim script is effectively > identical to > the /usr/bin/wish script, but the gvim window ends up in the > foreground. > I'm running Panther (10.3.3) with Vim version 6.2.195, which I got from > http://macvim.swdev.org/OSX/. > >> From: Jim Ingham <ji...@ap...> >> Date: Thu, 25 Mar 2004 14:26:30 -0800 >> To: Michael McFarlane <mic...@na...> >> Cc: tc...@li... >> Subject: Re: [MACTCL] wish from the terminal window >> >> Michael, >> >> This is the way all apps launched through exec behave on X. So I >> guess >> somebody designed it, but not me :-) Note, BTW, that if you use >> /usr/bin/wish to open the wish shell, then Activating that after >> launch >> wouldn't do any good anyway, because that is just a shell script that >> launches the real wish... >> >> Of course there is nothing I can do about launching from the Terminal. >> I guess I could change Wish so that it foreground's itself when it >> gets >> to the event loop, but apps that do this really tick me off, so I am >> not inclined to... >> >> I don't even think it is a good idea for us to blanket foreground any >> app you launch through exec, though. That seems undesirable in some >> cases. >> >> The correct thing to do is to have the launching app send an activate >> event to the child application after it is launched. That's what >> things like the "open" terminal command do. >> >> A super-cheesy way to do this is: >> >> osascript -e 'tell application "Wish Shell" to activate' >> >> for instance... This is going to fail if all your Wish based apps >> have >> the same signature (i.e. if you just launch them with "wish foo.tcl" >> ) >> The AE Manager won'tYou would have to make separate applets with >> different App names & signatures for this to work. This isn't hard to >> do, BTW, it just involves making a copy of the Wish Shell, and editing >> the plist a bit... >> >> It would be cool if we could do this for you, some extension of "tk >> appname" maybe... But, the App name for Mac OS X is registered by the >> window server when the App starts. I don't think there is any way you >> can change this dynamically from within the app. >> >> You could also do this with tclAE. I don't know whether tclAE can >> send >> to an app by PID. Mac OS X supports a typeKernelProcessID addressing >> mode as well as the Classic typeProcessSerialNumber so it should be >> possible to make this work. Does anybody else know... >> >> Jim >> >> >> On Mar 25, 2004, at 11:54 AM, Michael McFarlane wrote: >> >>> When launching wish from the terminal window (via /usr/bin/wish), the >>> application launches but a user must manually "pop" the application >>> to >>> the >>> foreground by clicking on the window or by clicking on the icon in >>> the >>> dock. >>> The same holds true if a wish shell is launched from within another >>> wish >>> shell. The child comes up behind the parent. If the child is >>> smaller >>> than >>> the parent, then you must move the parent out of the way to find the >>> child. >>> >>> Is this a bug, or was this done on purpose? Is there a way around >>> this >>> operationally? The reason I ask is because our org uses a whole >>> suite >>> of >>> wish scripts that were built for Linux and X windows, many of which >>> spawn >>> off children. Most everything works well on TclTkAqua except for the >>> inconvenience of popping the child windows to the foreground. >>> >>> Thanks for any help. >>> Mike M. >>> >>> >>> >>> ------------------------------------------------------- >>> This SF.Net email is sponsored by: IBM Linux Tutorials >>> Free Linux tutorial presented by Daniel Robbins, President and CEO of >>> GenToo technologies. Learn everything from fundamentals to system >>> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click >>> _______________________________________________ >>> Tcl-mac mailing list >>> Tc...@li... >>> https://lists.sourceforge.net/lists/listinfo/tcl-mac >>> >> -- >> Jim Ingham ji...@ap... >> Developer Tools >> Apple Computer >> > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > Tcl-mac mailing list > Tc...@li... > https://lists.sourceforge.net/lists/listinfo/tcl-mac > -- Jim Ingham ji...@ap... Developer Tools Apple Computer |