Jump to content

How to copy a file to clipboard from a workflow?

Recommended Posts

Hi folks,

I'm developing a custom workflow. After lots of searching around, I don't find a way to copy the chained file to the clipboard. I've found "Save image to clipboard" in Alfred 5, but I want to copy any file given. Alfred file actions has it, but I don't find any workflow action for that.


Any help is appreciated.




Link to comment

Welcome @Usman,


You can’t just copy any random file to the clipboard. Well, you can¹, but it’ll just be a bunch of data with no guarantee of being accurately pasted. That’s why copying image data is a specific action, it’s done properly to accommodate the input.

Lest this be an XY problem, please describe what you want to do instead of how you think it could be accomplished.

¹ Use a Run Script Action with default actions and code pbcopy < "${1}" to copy the contents of whatever file path is given as input.
Link to comment

@Pearcen, your thing works great, thank you! I just can't figure out why it fails randomly for some files. I can't find a pattern for the failed files. Attached is a screenshot that shows the failed files with a red exclamation. Do you've any clue?




Edited by Usman
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...