trendspire Posted June 18, 2020 Posted June 18, 2020 Two days with Alfred and although I love most of the features, I cannot believe I cannot store an image (either locally in Alfred or in local file system) for later retrieval and pasting in various documents. After testing many methods including snippets and workflow scripts, it's not working. All of my permissions are 'good'. Using Catalina on last version of Alfred v4. Tell me I am missing something!
deanishe Posted June 19, 2020 Posted June 19, 2020 Alfred's clipboard history can handle images, but otherwise it will only paste text (plain or rich). If you want to put an image on the clipboard, you'll have to create a workflow with custom clipboard-handling code.
trendspire Posted June 19, 2020 Author Posted June 19, 2020 Thanks for your suggestion. I did just that, and tested all the workflows that I could find on forums, stackoverflow, etc. Besides ending up with nothing on the clipboard or Permission Denied results.. (even though all my permissions are set AND I made sure the path is executable in the Mac OS), nothing is working to do this somewhat 'elementary task'? What about storing the image in Alfred.. or on clipbard que via static string? Can't believe this is not native. Sorry.. Alfred is great in every other way, but this.. mm.. frustrating, when I'd like to have a few logo versions at the ready.
deanishe Posted June 19, 2020 Posted June 19, 2020 30 minutes ago, trendspire said: I did just that, and tested all the workflows that I could find on forums, stackoverflow, etc https://stackoverflow.com/a/51447031
trendspire Posted June 19, 2020 Author Posted June 19, 2020 Tested the above: Result nothing pasted.. clipboard passes 'unknown / items' when viewed at the finder.. Tested a PNG and JPG on local hard drive In Alfred using osascript: [08:56:18.895] Copy logo to Clipboard - COPY[Snippet] Processing complete [08:56:18.906] Copy logo to Clipboard - COPY[Snippet] Passing output ' ' to Run Script
deanishe Posted June 19, 2020 Posted June 19, 2020 I tested it before I posted it, and it works perfectly in the applications I tested it in (including Finder). Here's a working implementation. If you're having a problem with a workflow you're building, and you'd like help, you need to upload the workflow somewhere (Dropbox?) and post a link to it. We can't diagnose a problem in a workflow we've never seen.
trendspire Posted June 19, 2020 Author Posted June 19, 2020 Ok. If I customize I will upload.. This time I added a trigger key combo to your working implementation above. Otherwise left it as is. [09:30:43.842] Paste Image[Hotkey] Processing complete [09:30:43.862] Paste Image[Hotkey] Passing output '' to Arg and Vars [09:30:43.863] Paste Image[Arg and Vars] Processing complete [09:30:43.864] Paste Image[Arg and Vars] Passing output '' to Run Script [09:30:43.963] ERROR: Paste Image[Run Script] /Users/dianne/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/D6DF5089-D9F1-46AC-859A-5CCEE389CE50:50:87: execution error: An error of type -4960 has occurred. (-4960) [09:30:43.976] Paste Image[Run Script] Processing complete [09:30:43.977] Paste Image[Run Script] Passing output '' to Dispatch Key Combo
deanishe Posted June 20, 2020 Posted June 20, 2020 22 hours ago, trendspire said: This time I added a trigger key combo to your working implementation above. That won't work if that's all you did. You also need to set IMAGE_PATH in the configuration sheet.
trendspire Posted June 20, 2020 Author Posted June 20, 2020 Not sure I understand.. I configured the following as per this screenshot, but still same results.
deanishe Posted June 20, 2020 Posted June 20, 2020 You need to set the variable in the workflow's configuration sheet. Alternatively, you could put the image path in the Argument field, but the configuration sheet is better practice.
trendspire Posted June 20, 2020 Author Posted June 20, 2020 Thank you @deanishe for sticking with me. I've now added the path to the configuration sheet as you suggest. Resulting output is still 'empty'. I cannot believe this is so difficult! ---- [15:22:36.453] Paste Image[Hotkey] Processing complete [15:22:36.478] Paste Image[Hotkey] Passing output '' to Arg and Vars [15:22:36.479] Paste Image[Arg and Vars] Processing complete [15:22:36.480] Paste Image[Arg and Vars] Passing output '/Users/dianne/Pictures/AlfredWorkflowFiles/TrendIncLogoType.png' to Run Script [15:22:36.682] Paste Image[Run Script] Processing complete [15:22:36.703] Paste Image[Run Script] Passing output '' to Dispatch Key Combo
deanishe Posted June 20, 2020 Posted June 20, 2020 (edited) 1 hour ago, trendspire said: I cannot believe this is so difficult! Difficult is relative. It took me 5 minutes… Open Script Editor and put this in a new script: set the clipboard to POSIX file "/Users/dianne/Pictures/AlfredWorkflowFiles/TrendIncLogoType.png" Run the script (Hit the play button), then open Finder and paste with ⌘V. What happens? Edited June 20, 2020 by deanishe
trendspire Posted June 20, 2020 Author Posted June 20, 2020 It properly pastes the logo.. Yea! But not in Alfred, I'm afraid.
deanishe Posted June 20, 2020 Posted June 20, 2020 5 minutes ago, trendspire said: But not in Alfred, I'm afraid. Then you likely haven't granted Alfred all the permissions you need to. Does the workflow work if you run it via its File Action?
trendspire Posted June 20, 2020 Author Posted June 20, 2020 Here is workflow I just now tested for File Action.. Not sure really, how to configure. Results are 'empty'. Same as before. Here is what I tried (just now): https://www.dropbox.com/s/g9zegfqdajptlvz/diannespastedimage.alfredworkflow?dl=0 Log: [17:03:08.364] Paste Image[Snippet] Processing complete [17:03:08.391] Paste Image[Snippet] Passing output '' to Copy to Clipboard [17:03:08.392] Paste Image[Copy to Clipboard] Processing complete [17:03:08.393] Paste Image[Copy to Clipboard] Passing output '' to Dispatch Key Combo Security and Privacy Settings in System Preferences are set for Alfred 4.app in: 1. Accessibility 2. Full Disk Access (Showing in Files and Folders as well) 3. Automation for a) System Events and b) Music.
deanishe Posted June 20, 2020 Posted June 20, 2020 17 minutes ago, trendspire said: Here is what I tried (just now): That won't work. I told you in my first reply that Alfred's Copy to Clipboard only supports text. You can't use it to put a file or an image on the clipboard. That's what the script in my workflow is for.
trendspire Posted June 20, 2020 Author Posted June 20, 2020 I did try your suggested script/workflow first. Can you please explain how you meant to test...? Quote Does the workflow work if you run it via its File Action?
deanishe Posted June 21, 2020 Posted June 21, 2020 (edited) Navigate to an image file in Alfred, activate File Actions, and choose “Paste to Active App”. Edited June 21, 2020 by deanishe
trendspire Posted June 21, 2020 Author Posted June 21, 2020 This works! When navigating to the PNG image.. It correctly pastes the logo in the active application where the clipboard was empty to start. My biggest issue in workflows is having to navigate using Alfred through my (extensive) filesystem. I'd like to have a few images, filefolders, snippets ready to go with a couple keystrokes.
deanishe Posted June 21, 2020 Posted June 21, 2020 11 minutes ago, trendspire said: This works! Then check that the fixed path you entered is correct. 11 minutes ago, trendspire said: I'd like to have a few images, filefolders, snippets ready to go with a couple keystrokes. Then put a List Filter in front of the script that copies the file to the clipboard, and put your selected files in there.
trendspire Posted June 21, 2020 Author Posted June 21, 2020 My path must have had a hidden issue, because I pasted again from working browser path, and what do you know it worked! I will test your suggestions about the List Filter. Still seems like a lot of work for a simple task. Thanks again for sticking with me through to the fix. I'll be sure to document all of your suggestions should I need them again.
deanishe Posted June 21, 2020 Posted June 21, 2020 54 minutes ago, trendspire said: Still seems like a lot of work for a simple task. I don't know why you keep saying it's a simple task.
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