Problems with 'Launch <doc> with <app>'
JonathanC at ag.nsw.gov.au
JonathanC at ag.nsw.gov.au
Sat Apr 17 19:22:44 EDT 2004
On 8 Apr 2004, at 3:27 pm, I wrote:
> Paste this into the (multi-line) message box and press enter:
>
> answer file "Choose app" of type "APPL"
> if it="" then exit to top
> launch it
>
> The chosen app should launch.
> (However, if it was running already, the result will be: "process is
> already open" - see below*.)
>
> Quit the app.
> Now paste this into the message box and press enter:
>
> answer file "Choose app" of type "APPL"
> if it="" then exit to top
> put it into ap
> answer file "Choose doc" of type "TEXT"
> if it="" then exit to top
> launch it with ap
>
> According to the Transcript Dictionary, the app should launch and
> chosen
> doc should open in it.
> However, the result for me is "no such program".
>
> I'm using Rev 2.1.2 on Mac OS X 10.2.8 (PowerBook G4 500MHz).
>
>
> * In HyperCard the equivalent "open [<doc> with] <app>" command would
> bring app to the front even if it was already running, which was VERY
> useful. Is there a way to do this in Rev?
To which Sarah Reichelt <sarahr at genesearch.com.au> replied on Thu, 15 Apr
2004:
> Hi Jonathan,
>
> I haven't investigated this for a while, but I did some tests a while
> ago and found that the main problem was due to OS X's hidden .app
> extension on application bundles. At my web site, you can find a stack
> called "Launch.rev" which uses a combination of AppleScript and
> Transcript to get around this problem.
>
> It can be easily extended to launch an app with a specified document.
>
> Cheers,
> Sarah
Hi Sarah. Thanks for the reply. I tried your stack "Launch.rev" but kept
getting "Error -43".
However, prompted by your advice that the problem is due to OS X's hidden
".app" extension on application bundles, and remembering that bundles are
actually folders, I opened the bundle and found the actual application
file I was looking for. I then made a note of all the folders surrounding
it (remembering to add ".app" for the bundle folder) and used this to
create my launch command:
launch "/Users/jonathan/Documents/Test.txt" with \
"/Application Folders/BBEdit 7.0/BBEdit.app/Contents/MacOS/BBEdit"
And this is what happened:
If BBEdit wasn't running, the document would open, as expected.
However, if I had already launched BBEdit from the Finder, the document
would open, but BEHIND Revolution!
Strangely, if I had already launched BBEdit from Rev, I would get an error
"Process already open" and nothing would happen.
Most surprising of all (to me)... if I then quit BBEdit and tried the
command again, I would STILL get the message "Process already open"!
It seems like Rev doesn't bother checking again with the System, it just
assumes.
I suppose a workaround could be to get Rev to quit the app first, then
launch it (again), but...
1. What command would I use for that? "Kill"? It appears that this only
works for processes opened with the "open process" command.
2. If I managed to do it (with AppleScript?) I could have the problem of
an unsaved document bringing up a dialog box, possibly behind Rev's
windows, that would bring things to a halt.
Thanks,
Jonathan
Jonathan Cooper
Manager of Information / Website
Art Gallery of New South Wales
Sydney, Australia
http://www.artgallery.nsw.gov.au
More information about the use-livecode
mailing list