AppleScript: How to check if the clipboard consists of a file (instead of text)?
If the Clipboard contains a file object, then clipboard info will contain, e.g., «class furl» (a file URL), along with many other classes.

The follow example code will check for the presence of «class furl» in the clipboard info:

if ((clipboard info) as string) contains "«class furl»" then
    say "the clipboard contains a file named " &amp; (the clipboard as string)
else
    say "the clipboard does not contain a file"
end if




Update:

As I mentioned in one of my comments, there are other ways to code this, and this approach will return either an empty list or a list containing one list, which should be faster instead of the 14 that the first example returns if it contains a file. If the Clipboard does not contain a file, then the list returned is empty and it errors out, setting cbFile to false, and if not empty, setting it to true, which then is tested against in the following example.

try
    (item 1 of (clipboard info for «class furl»))
    set cbFile to true
on error
    set cbFile to false
end try
if cbFile then
    say "the clipboard contains a file named " &amp; (the clipboard as string)
else
    say "the clipboard does not contain a file"
end if


By the way, I ran the purge command in Terminal in between testing these two examples and it felt like the second example is a bit faster, however YMMV.