Re: Opening another app in the background
Re: Opening another app in the background
- Subject: Re: Opening another app in the background
- From: Paul Berkowitz <email@hidden>
- Date: Mon, 05 May 2003 07:15:08 -0700
On 5/5/03 1:43 AM, "Jeffrey Mattox" <email@hidden> wrote:
>
My application is opening an AppleWorks 6 database (on OS 10.2.5) thusly:
>
>
tell application "Finder" to set theDir to folder "Documents" of home
>
tell application "AppleWorks 6"
>
open file "database.cwk" of theDir
>
end tell
>
>
I'd like to have Finder and AppleWorks launch (if necessary), open
>
the document (if not already opened), and stay in the background --
>
that is, not activate and come to the front.
>
>
I can re-activate myself after doing this, but the document flashes
>
on the screen. Is there a way?
It would be rare for the Finder not to be already present. However, to be
consistent:
tell app "Finder"
launch
set theDir to folder "Documents" of home
end tell
tell application "AppleWorks 6"
launch
open file "database.cwk" of theDir
end tell
'launch' opens an app in the background if it's not open. If it is open, it
does nothing.
Of course you don't need the Finder at all:
set theDir to (path to "docs")
or
set theDir to path to At Ease documents folder
Those give an 'alias' result, as to:
set theDir to alias (
(path to current user as Unicode text) & "Documents:")
I don't have AppleWorks, but you seem to be using Finder terminology within
it. (Your 'theDir' is a Finder folder object, and 'file "database.cwk" of
theDir' only makes sense as a Finder file.) It's interesting that it can
deal with a Finder object, or maybe AppleWorks uses the same terminology
itself? Or does the dictionary say that 'open' takes 'alias' or 'file'
(AppleScript terms)? I would have though it would simply want this:
set theDir to (path to "docs") as Unicode text
tell application "AppleWorks 6"
launch
open alias (theDir & "database.cwk")
end tell
--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.