It can depend on what type of data is in the clipboard.
But, you can (usually) check which types of data are in the clipboard by using the AppleScript command clipboard info
. That will give you a list of the available types.
So, for example, if you copy some styled text from TextEdit and run clipboard info
, you will see something like this:
{{«class RTF », 615}, {«class utf8», 220}, {«class ut16», 442}, {string, 220}, {Unicode text, 440}}
Then, you can get a specific type of data like this:
get the clipboard as «class utf8»
Now, on to the more complicated part of your question, where the app putting objects into the clipboard is using a non-text format.
I don't have Final Cut Pro available to see what it puts in the clipboard, but the app FileMaker Pro can copy various objects, and it puts them into the clipboard as data that can be converted to XML.
One way to convert such a data object into simple text XML is like this:
set dataObject to get the clipboard as «class XMSS» -- FileMaker script steps
set tempDataPath to ((path to temporary items) as string) & "tempfile.data"
set someHandle to open for access file tempDataPath with write permission
tell application "System Events"
write dataObject to someHandle
end tell
try
close access file tempDataPath
end try
tell application "System Events"
set dataAsXML to read file tempDataPath as «class utf8»
end tell
return dataAsXML
Now, to figure out what to use with get the clipboard as…
you would need to copy the object you want, then run clipboard info
to see what the data type is (in my example, XMSS). AND, note that you might get lucky and only need that single line of AppleScript, if the result is in plain text (in your case, possibly plain text XML). But, if you get a result like «data CODE…bunch_of_hexadecimal»
, then "CODE" is the data type you would use in the get the clipboard as «class CODE»
command, and you would need to convert that hexadecimal into text.
This sample is a boiled-down version of what I built in FmClipTools, in the dataObjectToUTF8 function of fmObjectTranslator, found at: https://github.com/DanShockley/FmClipTools/blob/master/Scripts/fmObjectTranslator.applescript
You can look there if you want to see the kind of error-trapping and more complicated options that might be useful.
Final caveat: Every now and then, I've run into clipboard data types that cannot be read this way.