Installing modules in Scriptable

Hi all. I am finally trying to get out of my Python comfort zone and make a useful script in Scriptable. To do so, I want to use a fuzzy-matching library I found.

I can see from Scriptable’s documentation under module and importModule that I should be able to put the library in any of several places, and the. Use importModule() to use it.

However, I don’t completely understand (a) what I put there, or (b) how I get it there.

Do I have to use git? If so, what’s the best way to do that from an iPhone (not near a computer for a bit). Or can I just copy the text of one or more of the .js files in the library’s got repo and make them into Scriptable scripts and use them that way — and if so, which .js files do I need and which are optional?

Thanks! This is always the most bewildering part of earning a new language for me — figuring out how to actually use it within existing file and app ecosystems…

I’ve had a look at the repo and found that you need to include the lib/fuzzyset.js. Just download it and put it somewhere in iCloud Drive/Scriptable. In your script, import it with

let FuzzySet = importModule("lib/fuzzyset.js");

if you have saved it in iCloud Drive/Scriptable/lib/fuzzyset.js in this example.

1 Like