Re: Copy and Replacing
Re: Copy and Replacing
- Subject: Re: Copy and Replacing
- From: has <email@hidden>
- Date: Sat, 5 Oct 2002 12:20:01 +0100
Paul Berkowitz wrote:
>
> With the Finder, additional confusion may exist because there IS a 'copy'
>
> command in its dictionary. [...] I'm too lazy to check the X Finder,
>
> though, so can't speak for that.
>
>
It's hard to say whether it's there or not! It's listed there as "(NOT
>
AVAILABLE YET)". So it wouldn't even copy to clipboard. It will compile and
>
then error.
Ah yes. Now I remember. Am I also right in remembering that the X Finder
(haven't been in X for weeks... 10.2's still in its box), allows
Windows-style copy-and-paste of file/folder objects? That might explain why
it's not yet [re]implemented: perhaps they're still deciding how to treat
the new behaviours?
>
It certainly seems crazy that the Finder AS team would create these
>
name-space conflicts with the AppleScript language: copy, file.
'Copy' seems to cause conflicts more in the user's mind than the language.
AS is smart enough to figure out what's meant by 'copy' depending on
context: 'copy foo' is one thing, 'copy foo to bar' is another. But it's
not the most obvious of distinctions, and perhaps invites confusion amongst
newer users (although 'file' is worse).
>
In the case
>
of 'copy' especially because they took over 'set the clipboard' into
>
Standard Additions around the same time as they made the Finder scriptable
The two commands work differently:
tell application "Finder"
activate
set the clipboard to selection
end tell
--> selection
tell application "Finder"
activate
copy selection
end tell
--> string containing one or more return-delimited filenames
Presumably because the latter keys directly into the app's own
[specialised] implementation of the copy function, while the former is
simply for moving a value to clipboard.
>
What did they even need 'copy' for?
Not sure. Getting file names (as the menu 'Copy' command does) can be done
through the object model. Perhaps to better support recording?
Anyway, I sympathise with the OP; I made the exact same error when I was
getting to grips with AS/Finder scripting. Application dictionaries tend
not to be very helpful when you need a deeper explanation (and examples) of
what effect a particular command has on a particular object. And their
terseness means they are, by necessity, heavy on jargon, which (along with
the lack a convenient glossary) can make them an intimidating read at
first. (Hopefully their future replacement will address this.)
2c
has
--
http://www.barple.pwp.blueyonder.co.uk -- The Little Page of AppleScripts
_______________________________________________
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.