Trying to add the "Where from" metadata in the Finder's "Get info" section of a picture on the Desktop and I am not able to since the text has special characters.
In this case, it is "?" and "=" that are present in "theURL_1". As you can see, I have removed these characters on "theURL_2" and it works just fine.
What would be the solution to include the full URL in the metadata?
set theFile to POSIX path of (path to desktop folder) & "cat.jpg"
set theURL_1 to "https://www.youtube.com/watch?v=EtH9Yllzjcc"
set theURL_2 to "https://www.youtube.com/watchvEtH9Yllzjcc"
do shell script "xattr -w 'com.apple.metadata:kMDItemWhereFroms' " & quoted form of theURL_1 & space & quoted form of theFile
whereFroms
attribute is added, it apparently just doesn't show up in the Get Info window (it doesn't in my Mojave test anyway). As mentioned, maybe the Finder is expecting a property list - to give that a try, check out my answer to a similar topic (note that the script is expecting a list of input file items).ls -ld@ /path/to/file
to show extended attributes, andxattr -p com.apple.metadata:kMDItemWhereFroms /path/to/file
to get the value of the whereFroms attribute (if it is there).