Usman Posted October 24, 2022 Posted October 24, 2022 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.
vitor Posted October 25, 2022 Posted October 25, 2022 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.
Usman Posted October 28, 2022 Author Posted October 28, 2022 Thanks @vitor! I've a list of files in Alfred. When the user presses enter I like to paste it in place, wherever the user is. I can paste by triggering Cmd + V. But I can't copy except image or plain text. For a live example please check the screen recording https://www.icloud.com/iclouddrive/07a-lw3n469tWD7fPus18Z0oA#Screen_Recording_2022-10-28_at_16.35.11
Pearcen Posted October 29, 2022 Posted October 29, 2022 Not the same use case but I got around a similar thing by using some AppleScript. Pass in the path&file Hope it helps in your use case
Usman Posted November 1, 2022 Author Posted November 1, 2022 (edited) @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 November 1, 2022 by Usman
vitor Posted November 1, 2022 Posted November 1, 2022 The pattern is that the failed files for some reason have a 0 at the end, after the extension. And they’re failing because (likely) they don’t exist. Question is why is the 0 being appended in the first place.
Usman Posted November 1, 2022 Author Posted November 1, 2022 @vitor that 0 is mysterious. I think the app where I'm pasting is causing this. I've debugged and there is no 0 in the pasted path. Other apps I tried paste these failing files as plain text path(without the 0) and works properly with files that worked here.
Pearcen Posted November 1, 2022 Posted November 1, 2022 @usman Glad it is 'sort of' working for you. Think we'll need to see the workflow to understand what could be happening here with those 0 files.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now