Jump to content

Paste a stored static image?


Recommended Posts

Posted

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!

Posted

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.

Posted

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.

Posted

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

Posted

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.

Posted

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

Posted
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.

Posted

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

Posted (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 by deanishe
Posted

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.

Posted
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.

Posted

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?

 

Posted

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.

Posted
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.

Posted

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.

Posted
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.

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...