Re: success! (was Re: move folder & copy image ?)
Re: success! (was Re: move folder & copy image ?)
- Subject: Re: success! (was Re: move folder & copy image ?)
- From: Nigel Garvey <email@hidden>
- Date: Wed, 8 Aug 2001 11:50:04 +0100
Michelle Steiner wrote on Tue, 7 Aug 2001 19:46:29 -0700:
>
On 8/7/01 6:31 PM, T. Breheny / DiGiTAL ZEN <email@hidden> wrote:
>
>
>tell application "Finder"
>
> make new folder at folder "clients"
>
> set the selectedItem to file "KICKer:desktop folder:clients:output"
>
> set the originalItem to the original item of the selectedItem
>
> move originalItem to folder "untitled folder" of folder "clients"
>
> set name of "untitled folder" to the clipboard
>
>end tell
>
>
>
>this works except for the last step-- it won't paste the clipboard to the
>
>new folder; i get the finder error: "some data could not be read".
>
>
I'm surprised that it will make the new folder because you don't identify
>
the full path to "clients" in two different places.
The Finder will assume that a file or a folder is on the desktop unless
told differently. If "clients" happens to be in the Desktop Folder of the
disk "KICKer" and it's the first (or only) folder with that name on the
Finder's desktop, then everything in the script except the last line will
work. It's not very robust system, though.
>
As for that last line,
>
>
First, you have to get the clipboard outside the "tell finder" wrapper.
More specifically, you have to address the 'the clipboard' command to the
frontmost application. If you first tell the Finder to activate, the line
will work - apart from the fact that "untitled folder" is just a string
and the folder it's supposed to represent isn't on the desktop. (There
might coincidentally, however, be another folder of that name there.)
Otherwise, the frontmost application will probably be whatever's running
the script. In which case you should either come out of the "tell finder"
wrapper or insert a "tell me" wrapper:
tell application "Finder"
-- blah blah blah
tell me to get the clipboard -- a one-line 'tell' block
set name of folder "untitled folder" of folder "clients" to the result
end tell
Ideally, though, you'd use 'activate' to be sure that the intended
application was able to access the clipboard.
NG