r/applescript • u/FakeNoises_ • May 05 '24
Translating Apple Script
I've recently got a new app to play music at my work (Soundtrack) and i'm trying to write a script to be executed within terminal to control the app. However the app doesn't work with apple script and instead has an API using json. I've got access to the API and I have a json script that works with the app but i'm unsure how to go about 'translating' it to apple script. TLDR; Is there a way to translate json to apple script? Any help would be amazing!
2
Upvotes
View all comments
Show parent comment
3
u/CaptureJuan May 06 '24
In that case you can:
Make an applescript “do shell script” followed by the curl command to effectively emulate terminal
Use an AS library/app called JSON helper to do your data formatting into Applescript friendly strings
Inject the data into the curl command
Like I said maybe not straightforward for a first project but this works for interfacing with RESTful type APIs so should work for this. Auth can be tricky though. Depends on the API