Jump to content

Images in snippets


Recommended Posts

I have gone through many posts here and im really struggling to be able to paste an image into a workflow. 

 

I have used the copy file to pathname method explained in other posts and added it to the setfilePath in the workflow but it just posts blankspace in any application. Never the suggested image. 

 

Any ideas?

 

I have attached the Run Script settings im using. 

 

 

Screenshot 2021-08-10 at 08.50.51.jpg

Link to comment

This look like my script and I've tested again and it seems to work on my side. Do you have connected the "Run Script" to a "Dispatch Key Combo" set to CMD+V to do the paste action ? Another point, are you testing your workflow in a text field that accepts rich text so the image can be pasted into it ?

 

It's better if you send the complete workflow instead of a screenshot of a single element if you want anyone to test it completely and try to find the bug.

Link to comment
On 8/10/2021 at 9:53 AM, UKDEVELOPER said:

I have attached the Run Script settings im using

 

That script looks suspicious. Why are you converting a POSIX file to an alias to a POSIX path, then back to a POSIX file?

Link to comment
42 minutes ago, deanishe said:

That script looks suspicious. Why are you converting a POSIX file to an alias to a POSIX path, then back to a POSIX file?

Yes, I know it has always been strange to me as well, but this is the only way I found out at that time to make it work with simple AppleScript commands. I'll see if I can find a simpler way, but at the moment this should work.

 

Pasting a simple `POSIX file (filePath)` doesn't work, at least, not on my tests...

Link to comment
7 minutes ago, deanishe said:

set the clipboard to (filePath as POSIX file) works for me

Hmm, you're right, I think I see why I had trouble... I've been testing with TextEdit and set it to Rich Text, but when I run the script it doesn't work, but it works when we drag and drop the file into the text field and then it asks if we want to switch to RTFD and then it works. I may have done those kind of manipulations before seeing that it worked with that strange script of converting from one to another POSIX file/path...

 

So, to put it there, this should work on a RTFD document:

 

set filePath to "/path/to/an/image.jpg"
set the clipboard to (filePath as POSIX file)

 

And here is a workflow as example: https://d.pr/f/JneYcR

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