For folks that want to ask questions of DT3 and automate tasks, this Warp.dev terminal tool has some powerful capabilities in terms of creating a workflow with the aid of various LLMs built into the interface.
You can speak in natural language (or type if you like) and it will write code.
To get started, I suggest using cmd+comma to open settings and check the privacy settings and also check the AI commands that are allowed to run automatically. For example, you might want to add osascript as one of the commands that is on the denylist so that you can verify what the terminal executes using applescript to connect to DEVONthink.
Because the LLMs like Claude 3.7 Sonnet will write code and execute it for you and because it has access to basically do anything you let it on your computer, this terminal might be a bit too powerful for the general user. Itās āsmartā enough and given the capability to do things like get extracts from DT3, save them to your temp folder, and then process them with other tools like bash or anything else you have available. It can handle installing and uninstalling whatever it needs to get the job done that you ask.
Please post interesting ideas to or feel free to share workflows that you have built because Warp is multi-user and does allow you to connect to another workstation or to share workflows in a team, etc.
Example: I wanted to get some statistics on my tags in a database I have been collecting. I wanted to analyze how often and at what time something is occurring. The database contains the when in the tags because thatās how Iāve been organizing and labeling each piece of data. The LLM was smart enough to write the applescript to extract all the tags, count each one and find the most common, etc. It even gives a helpful analysis of the non-time based tags.
The code was not one-shot. It took the LLM some time to work out a proper applescript, but what is nice is that as it makes errors, it automatically reads the results and corrects itself only prompting me if I want to execute the next command it wants to try. No more copy/paste.
Also, once itās done, you can right-click and copy the code to a workflow, add an alias and any variables you wish.
You post a bunch of badly written shell code and tell us itās AppleScript. What is the point youāre trying to make ā that your favorite A"I" doesnāt know apples from oranges?
Anyone with a basic understanding of scripting could do that in half the LOCs, maximum. And that would be readable, too.
I think AI tools over-promise in the hands of people who do not have some basic understanding of coding or scripting in any language.
But itās pretty timeconsuming to keep track of multiple languages and libraries - especially for power users who use a computer in another profession.
AI coding can work very well for such a person who understands the basic principles and thought process of coding but does not have time to master the syntax and other nuances of scripting languages.
I do not suggest for a moment that such ācodeā would or should pass the bar for use in commercial software projects. But it can be terrific for 1-off scripts used by one person on his computer. And it can also be great as a proof of concept to hand off to a professional developer when a more robust long-term app is the goal.
I can see the attraction here for the power-user audience.
** Even more notable - I see that it can answer questions about coding/command line operations as well. That of itself can be really helpful. Most open-source projects installed to the command line from Github have some āgotchaā somewhere. A tool that can help me figure out those issues could be very helpful.
hardly? Youāre too kind.
That is not AppleScript, Iād say, in the least.
Not only is it some oblique melange of the shell and incorrect AppleScript, but nothing is learned in the process.
And thatās the dangerous part. Nobody should execute AI code without reviewing & understanding it first. In the best case it just doesnāt work or returns some wrong output, in the worst case it corrupts your data (e.g. by moving, modifying, renaming or deleting items). Especially AI-generated AppleScript is prone to errors as thereās not that much AppleScript on the web (compared to e.g. JavaScript or Python).
BTW:
A simple alternative to the above script is Tools > Filter > Tags, then enable the options View > As List and Sort > By Count via the contextual menu.
Too long. Not really the fault of the AI, but that this is the first time Iāve used Warp and I was pretty weak in giving it instructions or even understanding itās user interface for getting the sequence of commands (my assumption of how that would work) into the āworkflowā. I think a better name for this Warp feature might be snippet. I ended up asking several questions that were really vague such as ācan you read from DEVONthinkā.
Yes, one of my favorite features in DT3 is the visual representation of word clouds. For this exercise I wanted the AI to respond with an analysis after getting the info. It was a fun exercise.
However, does anyone know how to disable a few modes on this robot that keeps trolling me? Some have a āDT3 Moderatorā tag, but Iād love to deactivate the āDismissive Authority Figureā and āAI Skeptic Level 10ā settings if possible and for the non-administrators that just like to troll, is there perhaps a mute option that allows them to read but prevents me from reading their drivel? Apparently, suggesting a tool triggered more than a few.
Of course, theyāre rightāI should have painstakingly hand-crafted my script using only the finest, locally sourced AppleScript instead of daring to let a tool assist me. What was I thinking, making automation more accessible? Clearly, such power should only be wielded by the worthyāthose who have memorized the sacred syntax scrolls.
Anyway, for those actually interested in productive discussions, Iād love to hear how others are using automation with DT3. Maybe even some gasp imperfect scripts that still get the job done.
Why is a discussion not productive if it points out the shortcomings of something? To clarify: you posted code stating that itās a useful AppleScript script. I pointed out that it is not AppleScript, but badly written Shell code.
I donāt see you proving that Iām wrong. And I donāt understand why you feel compelled to defend the bad code of an A"I".
If you suggest code publicly, you should be aware that people might comment it. Thatās not a criticism of your person, but of the code. And it offers the opportunity to learn something. Which would be facilitated by posting code as such, instead of a screenshot.
And yes, if someone wants to code, they should learn it. Like they have to learn playing a musical instrument, removing an appendix, flying an airplane. If you cut out my tonsils instead of my appendix because a program told you to do so and you couldnāt be bothered to study anatomy, Iāll not be happy. And Iāll say so.
If you want to see productive scripts: this forum is full of them. And thereās also Scripting with JXA | JavaScript for Automation (JXA) which follows a more systematic approach than just publishing recipes.
I would like to discuss Warp and using AI inside a terminal (and eventually inside DEVONthink if it ever becomes interesting).
If you want to discuss other stuff, feel free to start your own thread. You are welcome to cricitize my posts or the code anywhere else, but not here. Itās not the topic an your opinion on the code produced is irrelevant. Take it somewhere else. Quote it or capture it, but donāt involve me.
Your comments are unwelcome. Thanks for your understanding.
Here comes a sample JavaScript. Save to a file like āscript.jsā and feed to osascript on the shell: osascript -l JavaScript script.js
Itās not tested for time-tags like āxxhmmā with xx/yy being hours and minutes. If it doesnāt work with them, adjust the regular expression in the line if (/\d\dh\d\d/.test(tag)) {
Advantages over the original proposal:
Pure JXA solution, no need for any shell commands
Pure JXA solution, no need for contrived UX via shell commands
Clear regular expression
Works also with tags containing |
No need for temporary files that linger around after the code terminates
Lists all tags, not only the 20 most frequent ones
Shorter
Disadvantage:
Tags are listed in arbitrary order, not in increasing frequency.
Everybody is welcome to comment stuff as long a he/she complies to the forum rules (e.g no offenses). This is not a filter bubble where people only get confirming responses.
Let me ask a bigger picture question whcih is why I was interested in warp.dev in the first place
What interested me about warp.dev is that often when I have tried to install open source software I get stuck because there are some issues installing it that are obvious to hardcore developers who are used to the Terminal but not to me. For that reason alone it might be nice to have AI which can help figure out those sorts of issues.
But taking it a step further - I have long thought there are likely automation tasks which are easier to achieve from the command line than through other methods. Such as perhaps sending or receiving webhooks to/from Devonthink.
Are there in fact certain automation scenarios which can be easily accomplished from the command line but not otherwise? If so what are those examples?
In other words - this particular āscriptā might well be achievable easily in JXA or Applescript. But putting that aside - assuming one is going to use AI to help code and thus the question is simply what lagnguage to code in - what scripts/tasks/automations can be better done in the terminal than through JXA/Applescript?