Screenshot Folder Actions

applescriptautomatorcatalinacopy/pastescreen capture

Ideally, I would be able to take a screenshot and paste the image directly into iA Writer. Since iA Writer doesn't store images, however, this is not possible.

In order to not have to manually drag every screenshot into iA Writer, I would like to be able to

  • take a screenshot,
  • save it in a folder
  • copy the file path to clipboard
  • paste the file path into iA Writer.

So far, I've changed the default folder for storing Screenshots and added a folder action. I found a script that copies the screenshot to my clipboard as a file. However, I can't figure out how to copy the file path to my clipboard instead, so I can easily paste it into iA Writer.
Any ideas? Could there be a better way?

on adding folder items to this_folder after receiving added_items
    set the clipboard to (read (last item of added_items) as TIFF picture)
end adding folder items to

Best Answer

This should work for you

property thePath : missing value

on adding folder items to theFolder after receiving theNewItems
    set thePath to POSIX path of theNewItems

    set the clipboard to thePath -- copies the file path to clipboard
    -- set the clipboard to POSIX file thePath -- copies actual file to clipboard

end adding folder items to