Re: Opening a document
Re: Opening a document
- Subject: Re: Opening a document
- From: Christopher Nebel <email@hidden>
- Date: Tue, 4 Oct 2011 17:00:34 -0700
On Oct 2, 2011, at 6:13 PM, DaveC wrote:
> I open my mail program by double-clicking on the Settings file. I cannot open the mail program first as it wants to create a new settings file with defaults.
>
> How can I open the Settings file by means akin to dragging and dropping the settings file onto the application? Or by double-clicking the Settings file?
>
> This is the attempt that isn't working (because it launches the mail app first):
> - - -
> tell application [email app]
> activate
> open "applications:[email app directory]:settings"
> end tell
> - - -
> Suggestions?
A few key points:
1. If you don't want the application to be running when it tries to open the document, don't tell it to do something -- like "activate" -- first! Reverse the "activate" and "open" lines.
2. Path strings are not file references in AppleScript, and file references are not path strings. You need to say 'open file "..."' or 'open alias "..."'. (This presumes that your path is correct, of course, which it may not be. What you wrote implies that your email application is on a disk named "applications". One way to get the right expression is to run a script consisting of just "choose file", choose the desired file, and then paste the result expression into your script.)
Other people have directed you to tell Finder to open the file instead -- this works, but all Finder is going to do is turn around and send the exact same "open" command to the application, so it's a bit unnecessary.
--Chris Nebel
AppleScript Engineering
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden