Re: scripting Word top copy text - should be simple, but ain't
Re: scripting Word top copy text - should be simple, but ain't
- Subject: Re: scripting Word top copy text - should be simple, but ain't
- From: Paul Berkowitz <email@hidden>
- Date: Thu, 27 Apr 2006 07:39:06 -0700
- Thread-topic: scripting Word top copy text - should be simple, but ain't
On 4/26/06 11:58 PM, "Brennan" <email@hidden> wrote:
>>> Except: how do you work out what document you've opened?
>>
>> Either by name, or by the fact that the most recently opened document
>> is window 1 or document 1.
>
> Yes, unless (for some reason) 'open' fails silently, in which case
> 'document 1' might be something totally different.
>
> It's a dangerous heuristic to assume that 'document 1' is the same as 'the
> most recently opened document', even if you use it on the very next line
> after 'open'.
>
> IMNSHO 'open' should either return a document reference or cause an error,
> and given it's a required Apple Event, that goes for ALL apps. Any other
> behavior is a bug and should be reported as such to the developers.
>
> FWIW this problem is not confined to Word. Apple's own TextEdit and many
> other cocoa apps have a similar problem. I posted recently a workaround
> for QuickTime Player, which also has the same kind of problem (although I
> suspect the underlying cause is different in the case of Word).
That's because it's Apple's own Standard Suite which does not specify that
'open' should have a result. It's Apple's fault. All those applications'
developers are merely following the Standard Suite's model - which does
allow for extra parameters to be added, but not for a result. Some
applications add their own, seemingly redundant commands in their own
proprietary Suites - like Excel's 'open workbook' and 'open text file'
commands - duplicating the Standard Suite's 'open' command, in order to be
able to provide a result. That's the way it has to be done, which is very
unfortunate. Maybe someone who was around way back when (Jon Pugh probably
isn't reading this, maybe someone can nudge him...) can explain why 'open'
doesn't come with a Result. Probably because all apps, even otherwise
unscriptable ones, are expected to respond to 'open' (as well as run, quit
and supposedly print), without requiring that they have a full AppleScript
model including a document class. And that's a shame.
Perhaps someone can say definitely if it is permitted for an application to
provide a Result to 'open' command in the Standard Suite.
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden