Take the Clipboard and make a text file

Can this be done just with Shortcuts or will I need Scriptable ?

I want to take a lump of text in the clipboard and to make a file from it. Will need to name the file along the way and give it a .asc extension. Saving the file in a specific place in my iCloud.

This would need to be under the shortcuts file path, unless you toggle Ask Where to Save, but that would involve manual navigation.

Thanks for your input Philip.

Tried that out and it mostly works. A added an ask for input so I could name the file.

Keeps naming the file with .txt and ignoring the .asc

Weird stuff??

file created

Ah yes, I see what you mean. Even adding an extra step to combine the name with the extension still saves the file as filename.asc.txt. Hmm. Bigger brains than mine might be required.

Got it! You need to add a Set Name action after you’ve saved the file.

  • ask for the filename (no ext)
  • save the file where you want it
  • pass the file to Set Name action with the original input plus .asc

Works here.

Aagh. Ignore me. I thought I had it working but was mistaken. Like I say, bigger brain needed :frowning:

Turn on the Don't Include File Extension option

1 Like

See what I mean about bigger brains? Well done! Just tested here and confirmed it works.

Magic - Spot on…

Thanks

Now I’ve made a duplicate which takes the text and does the same without the need for the clipboard.

Means I can have it in a share sheet.

I’ll probably get that into Drafts too seeing as I do most with Text in Drafts.

Cool. And don’t forget that you can add a folder path e.g. /Shortcuts/myfolder/ to keep output organised.

Seems to want to save only to the Shortcuts folder on iCloud Drive. So I used Hazel on my Mac to watch that folder and do a rename and copy to a place where I wanted it.

There are nearly always work-arounds…
Or many ways to skin a cat…

Yes, the sandboxing means files can only be saved under /Shortcuts/ unless some-third party method is used.