Hi guys,
What I’m trying to accomplish sounds pretty simple but couldn’t find the way/answer so far:
After retrieving the value of a static text from a UI element (it is a plain text containing some paragraphs) and assigning it into a variable, then I set the clipboard to that variable.
ie.
[format]
tell text field 1 of group 1 of UI element 1 …
set theBody to its value
end tell
display dialog theBody – displays the entire body keeping its original format
display dialog class of theBody – displays ‘txt’
display dialog every paragraph of theBody – displays just 1 record which contains all the paragraphs
set the clipboard to theBody
[/format]
Once the clipboard is assigned the content of the ‘theBody’ variable, here is where it comes to me the real issue, when I go ahead and paste the content of the clipboard into any application like TextEdit, Sublime Text …
The original format is lost, instead what it yields is an unformatted unique string, like a long sentence.
Surprisingly, if I reassign the clipboard content into “theBody” variable, this variable keeps the original formatting in the script:
[format]
set theBody to the clipboard
display dialog theBody – displays the entire body keeping its original format again
[/format]
How I could make the clipboard to keep the original formatting so I can paste it in any application?
Thank you in advance
Marius