Beta for Scriptable 1.3

Hi,

The beta for Scriptable 1.3 is now open. There’s a lot of changes in the update. Here’s some of the highlights:

  • New rich notification composer that makes it easy to schedule notifications.
  • Multiple Siri Shortcuts on a single script. Supports pre-defined arguments that can be read in your scripts.
  • File bookmarks make it possible to work with files and folders outside of Scriptables documents folder.
  • Run scripts without opening the editor.
  • Add scripts to your home screen to quickly run it.
  • The new importModule(path) function makes it reusing code a breeze.

I’ve posted videos of the highlights in this thread on Twitter:

Sign up here if you’d like to help test the 1.3 update: https://testflight.apple.com/join/klHcZHjN

6 Likes

So the new importModule only works when importing code files that are set up with the module.export stuff? That’s a great step for reusing some functions in several scripts. Will there be a way to import arbitrary code files like external libraries?

Hi,

Yes, it uses module.exports but please note that it is not compatible with require() from Node. Can you give an example of what kind of external libraries you want to import?

Not the OP, but I would like to import a(ny) crypto library that implements the MD5 message-digest algorithm.

(I now chose a random implementation on the internet which I import using this new importModule function, but I’d rather not have that source in Scriptable at all)

1 Like

I was wanting to import moment.js. It just makes dates much easier to work with.

1 Like

I’m not completely sure what you mean what you say you’d rather not store it “in Scriptable at all”. You’d always need to store the module somewhere on the disk. If you don’t like the module cluttering your list of scripts, and I totally understand that, you can create a directory in Scriptables documents directory, i.e. /iCloud/Scriptable, and load the script from there.

For example, I have the folder /iCloud/Scriptable/lib and I store all my reusable code in there. So if I have a module with filename md5.js in there, I can load it with loadModule("lib/md5").

1 Like

I’ve just tried and it seems that moment.js is compatible with Scriptables importModule(path). Don’t generally expect modules that weren’t designed for Scriptable to be compatible with importModule. It is mostly meant for reusing your own code.

To get moment.js working, you need to store this file somewhere on your disk and then load it like you normally would, e.g. let moment = loadModule("lib/moment").

1 Like

A post was split to a new topic: Table Background Colour

I meant: “I don’t need to view/edit the source code in Scriptable”, so your solution works.

Before I try; how does this impact Working Copy’s Files synchronisation?

Will files in lib be included or excluded by default?

lib is included by default. I haven’t tested this but if you want it excluded, you may be able to add it to your .gitignore. I’m not sure if file synchronisation respects .gitignore.

Inclusion is fine, actually. Works like a charm!

Oh darn. I see the beta is full now. I was on the previous beta and use Scriptable a lot. I’d love to continue to test if needed.

Scriptable 1.3 is out now. Here’s a short video highlighting some of the new features.

3 Likes

What app are you using at the end to edit the module?

That’s Kodex. It’s an excellent minimalistic code editor. I’ll also take the chance to recommend Textastic which packs a bunch more features but also an extra level of complexity.

2 Likes

Thanks, Simon! Kodex is great! It’s exactly what I’m looking for.