Jump to content

[Workflow] Create a new text file with clipboard content

Recommended Posts

Here is a simple workflow to create a text file with clipboard content in the current or top most Finder window/folder:


1. using a hotkey: the text is created with the following filename pattern: Clipboard - yyymmdd(hhmmss).txt

2. you can use newf key in Alfred (see screenshot) so you can write the first part of the file name (use CTRL key to remove the date and time from the filename).


The default date and time was code this way in order to always generate an unique filename.














This workflow is more a sample on how to use Shell/Bash and AppleScript together.


Credits to phyllisstein and his workflow* and David Ferguson for helping.


* http://www.alfredforum.com/topic/394-fixed-create-a-new-file-in-the-finder/

Link to comment
That's awesome! Should be very handy; great job.


Thank you.


Great stuff. Works really well. Make sure you upload it to the Alfred Repository so we can get auto-updates and the like.


Very interesting! Done.


One tiny suggestion — make the keyword argument "optional", and just give the file a generic name if the user doesn't specify one.


That’s a good idea. I’ll see if I can code it.

Link to comment
  • 3 months later...

Great workflow!


Do you think it would be hard to autodetect whether the clipboard content is an image or a text to save it accordingly?  


Regarding text this workflow is better and you can also save in current Finder window.


When you say image what exactly you mean? A peace of it from an image editor? 

Link to comment

Thanks for the updated link,


I meant, I'd love to be able to quickly save an image that I have in the clipboard (typically, I just did a screenshot to the clipboard, and I now have to create a file for some reason)


FYI: In OSX you can use Command+Shift+4 to take a custom screenshot* and get a file saved in the Desktop automatically.


*Hit space bar then mouse click a window to take its screenshot

Link to comment

Yes, I know this (I actually use the Alfred2 screenshot workflow), the thing is: sometimes I took a clipboard screenshot, and I realize I have to send it to someone, so I have to open an image app & paste it, whereas as "Save clipboard as file" workflow would make it a snap (although I reckon this is something of a rarified occurence :)

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