Hello McUsr
Look at this sample :
set word_ to ("Don't München It") -- word to enter
set the clipboard to word_
the clipboard as record
--> {Unicode text:"Don't München It", string:"Don't München It", scrap styles:«data styl01000000000010000E00030000000C00000000000000», «class utf8»:"Don't München It", «class ut16»:"Don't München It"}
As You may see, when we store the string in the clipboard, this one get several informations :
{
Unicode text:“Don’t München It”,
string:“Don’t München It”,
scrap styles:«data styl01000000000010000E00030000000C00000000000000»,
«class utf8»:“Don’t München It”,
«class ut16»:“Don’t München It”
}
When we paste, the target application grab one of these informations.
TextEdit and Pages grab the «class utf8» and the scrap styles.
They have no other special job to achieve.
Quite often, when I grab datas from existing documents I edit the clipboard’s contents.
For instance, when the datas are grabbed from Safari, I have to remove some informations because they are badly formed. If I don’t do that, the pasted “tables” are changed in an awful text in which tab characters are replaced by linebreaks. It’s the case if I copy the table describing the state of my bank account or if I copy the list of songs displayed by Amazon for CDs.
The clipboard receive :
«class weba»
«class rtfd»
«class RTF »
«class utf8» in which tab chars are correctly used
«class ut16» in which tab chars are replaced by linebreaks
uniform styles
string in which tab chars are replaced by linebreaks
scrap styles
Unicode text in which tab chars are correctly used
So, when I want to keep the table structure I use
set the clipboard to (the clipboard as «class utf8»)
So, i’m sure that the target app will receive a table, not a list of single values.
Yvan KOENIG (VALLAURIS, France) vendredi 12 avril 2013 17:05:53