MacOS – Save the URL in Finder as a bookmark via Automator

automatorbookmarksfinder-tagmacosurl

Since the possibility to tag files in Mavericks, I save my bookmarks in Finder to be able to tag them and find them later more quickly.

To do this I simply drag the URL in Safari to a my bookmarks folder in Finder.
After doing this for many times, I found it inconvenient to do this manually. It would be nice if this steps can be automated, and I think Automator would help me in this.

The workflow would look like this.

  1. Copy the URL of the webpage in the active Safari window.
  2. Save the URL in a clickable URL file in a folder in Finder.
  3. Prompt me the Info screen to edit metatags, like Filename, Tags, and Comments.

Unfortunately, after some trying in Automator, I'm still not able to create this workflow.
I hope through this post somebody can help in the right direction.

Best Answer

You could install tag with for example brew install tag and then use a script like this:

set tags to text returned of (display dialog "" default answer "")
tell application "Safari" to tell document 1 to set {u, t} to {URL, name}
tell application "Finder"
    make new internet location file at POSIX file "/Users/username/Bookmarks" to u with properties {name:t}
    set p to POSIX path of (result as alias)
end tell
do shell script "/usr/local/bin/tag -s " & quoted form of tags & " " & quoted form of p

For Chrome, use tell application "Google Chrome" to tell tab 1 of window 1 to set {u, t} to {URL, title}. Separate the tags with commas in the dialog.