Mac Automation – AppleScript, JavaScript for Automation (.JXA), and JavaScript (.JS)

I learned AppleScript last year and it’s gone pretty well. After discovering BetterTouchTool, I learned about utilizing JXA or JS for automating tasks.

I can make sense of the .jxa documentation on apple’s Apple’s JXA Release Notes

I can also write very simple scripts with BTT’s JavaScript functions(?)

I have a few questions which I’ve googled answers to, but I don’t think they apply to me.

  1. I was told by someone on another forum that I should switch to using JXA instead of AppleScript because it’s more current. I researched it and it looks like both AS and JXA aren’t being developed further. Is there a reason why I should re-write my libraries to JXA? (next question might provide insight what I want)

2. Can I write apps/libraries that use any combination of these three languages? AppleScript is VERY limited in the sense of working with dictionaries (records) and string manipulation etc… I know JavaScript has so many functions built into it- which would make my code so much cleaner (and more ummm… reliable? some of my “from scratch” functions are absolute trash). It doesn’t look like JXA adapts any of these functions, right? I’ve found a few JXA/AS libraries people post on GitHub that essentially replicate these. Am I going about this the right way? I’ll put my project’s requirements at the end

I started diving into node.js (which is what I think the BTT’s JavaScript Functions link uses. I know THAT can call AppleScript functions as also mentioned in that link. (I posted another topic on this here if anyone has a solution to that too. Also, I know AppleScript can do the terminal command to run a javascript file- my issue is passing inputs/return values to each other… and also creating an organized structure.

Project:
(100% for personal use and not to distribute- mostly because it basically requires every permission enabled)
-communicate with Apple Music to gather metadata, easily work with playlists- add, delete, etc..
-backup my metadata (currently using Numbers, but might switch to SQL?)
-icon automation which requires file and image manipulation (Pixelmator Pro has an extensive AS dictionary, so I’m using that)
-then using these scripts in conjunction with BTT to create cool UI’s (automating the buttons etc uses JSON to transfer data between the code and BTT- I wrote a very sloppy AS function to “encode/decode” JSON. The buttons and icons will constantly be changing, so automating these needs to be easy- not spaghetti code like I have (with my personal libraries and icky JSON en/decoder)

Oh and last thing… I stumbled upon Obj C with AS or JXA, but I am already overwhelmed with the 3 languages mentioned. Is it worth diving into this a bit more? Oh and I’m realizing using terminal commands/scripts might also be worth diving into a bit more?

I hope this question is concise because it definitely is not in my head. I apologize if I provided excessive info.

Thanks in advance!