Re: Scriptable multi-clipboard utility?
Re: Scriptable multi-clipboard utility?
- Subject: Re: Scriptable multi-clipboard utility?
- From: Shane Stanley <email@hidden>
- Date: Mon, 10 Mar 2014 22:20:15 +1100
On 10 Mar 2014, at 8:53 pm, koenig.yvan <email@hidden> wrote:
> It will certainly rain today.
I wish...
> It's the first time where I see you writing something resembling a bit of inconsistency.
>
> How may be the three filenames in the record and one in each pasteboard ?
Because that's the way it works. I suspect it's partly to be backwards compatible with older apps that do not support multiple clipboard items. But it's also a matter of trying to provide what the pasting app is likely to want.
The way clipboards work is this: when an app copies, it tries to store the contents in all the versions that might be useful to some other app, as well as itself. So text from a styled text app will put RTF, UTF8, etc. When it's time to paste, the pasting app provides a list of types it wants, in preference order, and the first one found is returned.
Now if the app is the Finder, and you have several files selected, what should it put on the clipboard? The files, obviously, in the form of URLs, and it makes sense to put them in separate clipboard items (apart from anything else, you can't have more than one entry of a particular kind in a clipboard item). But if the client that is going to paste is looking for text, in the form of the names of the files, it makes more sense to put all that info on just the first clipboard item, so the names are run together, separated by linebreaks. That way it works with older apps (and with AS's clipboard command), and a client looking for text can get it easily -- the clipboard can be assumed to contain a single string, if any.
(When you might put separate bits of text in separate clipboard items is if you support non-contiguous selection. But then you'd need to be aware that someone pasting into another app will probably only get the string on the first pasteboard.)
So when you got the clipboard as a record, you got:
(*
{«class furl»:file "Macintosh HD:Users:yvankoenig:Desktop:mailboxes.txt",
«class ut16»:"mailboxes.txt mailboxes 2.txt",
«class utf8»:"mailboxes.txt mailboxes 2.txt",
Unicode text:"mailboxes.txt mailboxes 2.txt",
string:"mailboxes.txt mailboxes 2.txt"}
*)
If AS supported multiple clipboard items and you could ask for clipboard item 2 as a record, you would have received:
(*
{«class furl»:file "Macintosh HD:Users:yvankoenig:Desktop:mailboxes 2.txt"}
*)
--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>
_______________________________________________
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