3 ms·
I wrote a similar tool in Python a few weeks ago, which uses AppleScript to liberate the data and saves it to a SQLite database: https://datasette.io/tools/appl
by simonw 4y ago
I wrote a similar tool in Python a few weeks ago, which uses AppleScript to liberate the data and saves it to a SQLite database: https://datasette.io/tools/apple-notes-to-sqlite https://datasette.io/tools/apple-notes-to-sqlite
I didn't actually know AppleScript before writing this tool... but it turned out ChatGPT knew it well enough to unblock me and provide me with exactly the code I needed to build the rest of the project! https://til.simonwillison.net/gpt3/chatgpt-applescript https://til.simonwillison.net/gpt3/chatgpt-applescript
Apple Notes Liberator creates a copy of the SQLite database and then runs queries against that directly to extract the data.
I chose not to do that (despite being all-in on SQLite for everything) because I worry about future changes to the software baking my script - I figured the AppleScript interface was less likely to have breaking changes in the future.
- pjot 4y agoI loved your post about the pelican! https://simonwillison.net/2020/May/21/dogsheep-photos/ https://simonwillison.net/2020/May/21/dogsheep-photos/
- frizlab 4y agoA bit out of context, but did you know you can actually write OSA scripts using JS? In Script Editor there’s a menu where you can change the language.
- tzs 4y agoFrom your article on how you wrote that: > I've been stubbornly refusing to learn AppleScript for nearly twenty years at this point. Thanks to ChatGPT I can continue not to learn it, but I can now use it to solve problems The Apple scripting stuff can also use JavaScript. It might be better to continue not to learn in JavaScript instead of AppleScript, if ChatGPT is as adept at Apple scripting in JavaScript as it seems to be in AppleScript. That way if you want to tweak what ChatGPT gives you it will probably be easier. With AppleScript both interacting with other things and control flow or computation can be weird and confusing. With JavaScript at least the control flow and computation will likely be more normal.
- aidos 4y agoI did a bit of AppleScript recently (scripted changing between draw and erase in zoom annotations from the buttons on my tablet pen). In my reading I got the impression that not everything is implemented in js so you might get stuck.
- simonw 4y agoHuh, that's a great tip! ChatGPT knew how to convert my AppleScript to the equivalent JavaScript and showed me how to run it too: https://gist.github.com/simonw/86c2153b7882747122f1e3d50126070a https://gist.github.com/simonw/86c2153b7882747122f1e3d501260... Added a section about this to my TIL: https://til.simonwillison.net/gpt3/chatgpt-applescript#user-content-bonus-use-javascript-instead https://til.simonwillison.net/gpt3/chatgpt-applescript#user-...
- IggleSniggle 4y agoI was trying to do a thing with AppleScript, and the barriers I ran into were not with the language, but with discovery of the APIs that Apple surfaces to the end user. In that regard, you’re better off with AppleScript. I can’t believe just how bad the AppleScript documentation is, but the js documentation is even worse; using js is just using AppleScript but with an additional layer of indirection that doesn’t provide any productivity gain.
- js2 4y agoThere's an O'Reilly AppleScript book that's pretty good. The problem I always had with AppleScript is that it wasn't clear when I was writing AppleScript and when I was talking to an application's OSA dictionary (its "terminology" as Apple calls it in OSA). Once I switched to Appscript (https://appscript.sourceforge.io/ https://appscript.sourceforge.io/), that confusion went away. Of course I haven't used that in years since it's no longer supported and today I'd use JavaScript. The issue though is that each application's terminology is isn't really documented. You can usually figure it out using Script Editor, but not always. Some of this is documented here: https://developer.apple.com/library/archive/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/AboutScriptingTerminology.html#//apple_ref/doc/uid/TP40016239-CH75-SW2 https://developer.apple.com/library/archive/documentation/La...
- jasonriddle 4y agoInteresting. I was curious and wanted to achieve something similar with voice memos. I used the prompt "Write applescript to loop through all of my Apple Voice Memos" and the code it produced couldn't run in applescript.
- simonw 4y agoI just tried that prompt against GPT-4 and got "Note that the Voice Memos app does not have an AppleScript dictionary, so the script will use UI Scripting to interact with the app" followed by a very complicated recipe.
- whatch 4y ago"Unblock" is the perfect term for the effect of all these GPT things on me. Thank you for coining that! Recently I wanted to have something like that but for Safari Reading list. The main difference is I tried to find a solution not for one time liberation, but for continuous 2-way exchange with some web service. It appears you HAVE to run everything locally for that. I like "privacy", but I like having options even more. By the way it was ChatGPT that helped me to remove this several month old item from my TODO list.
- ivansavz 4y agoHere is a Python library that can also create notes: https://github.com/RhetTbull/macnotesapp https://github.com/RhetTbull/macnotesapp It is also based on Action Script commands. I haven't played with it much yet, but it's on my TODO list (to add automatic headings for every day + archive DONE tasks automatically).
- Zufriedenheit 4y agoNice tool! Just tried it, works great. Interesting that Applescript exports the images as Base64, or does Apple notes store them like that as well? Maybe converting them to binary when exporting would save some space.