Saving to the Home folder on the Mac using Scriptable


I need to do a few automations, to do this I need to use Scriptable to create a folder name and then check if the folder exists, if it doesn’t then do this or if it does than do that.

I know in Shortcuts you can now save to a folder outside of iCloud, I can’t work out how to do this with an incline Scriptable script.

Any ideas?

The mac beta version if Scriptable is a little old and a little outdated.

Ideally, you should be able to bookmark Folders (under Settings > File Bookmarks) and be able to access them via FileManager.bookmarkedPath. Adding a bookmark just freezes the app - at least for me, on my also old 2016 macbook pro.

If it’s a must to use Scriptable, you could offload the folder checking to Shortcuts by running a shortcut using CallbackURL.

To save files into the desired folder, store the files temporarily in the Scriptable folder or a subfolder under it and then kick off another shortcut to move them from Scriptable to the target folder.

This is obviously a work-around but if you’re not limited to Scriptable, there are other tools you can use.

Thanks, I just tried it and it freezes for me also.

Basically my shortcut works as follows: I ask the user for a company name, it then uses Scriptable to take that name, creates a code and combines everything to make the folder name. It then checks whether that folder exists, if it does then do this, if not then do something else.

Can I do this in Shortcuts use Scriptable and then back to shortcuts again?

Since you’ve started with Shortcuts, you can just take the output from the script and use it in your shortcut.

Thanks, I started doing as you said but I now need to get the folder contents or url so I can check for duplicates in Scriptable. I’v tried using get contents from folder bit I get the following error.

The reason for the error is either a missing quote at the end of let BaseContentsArray... or some of the folder contents has quotes so it messes up the syntax. My suggestion is to use pass the variable as parameter to the script instead of embedding the values as part of the script.

Anyway, with some clues from, i presume, your Reddit post maybe this shortcut would do it.