Jump to content

AppleScript Dictionaries — Find and open Mac automation dictionaries


Recommended Posts

Posted

When reporting issues, please include your exact installed versions of:

  • The Workflow.
  • Alfred.
  • macOS.

In addition to:

  • The debugger output. Perform the failing action, click “Copy” on the top right and paste it here.
  • Details on what you did, what happened, and what you expected to happen. A short video of the steps with the debugger open may help to find the problem faster.

Thank you. Accurate and thorough information is crucial for a proper diagnosis which allows me to help you better.

  • 2 months later...
  • 2 months later...
Posted

 Hi @vitor - This is an awesome workflow! Thanks for sharing!!

 

I have a couple of apps whose AppleScript dictionaries work perfectly fine (and are visible in the Script Editor's Library pane) but aren't visible in the workflow's output. Do you have any suggestions for troubleshooting these apps? For example, one dictionary that I use quite a bit, which won't load correctly, is DEVONthink 3. The other apps are all really minor; DEVONthink 3 is, really, the only important one.

 

Thanks for any help you can lend, and for the great workflow!

Posted

Run :applescriptdictionariesforceupdate to force an update of the cache. May take a couple of minutes. If it still does not show up, where do you have DEVONthink installed (the full path)?

Posted (edited)

@vitor I'm not sure if it's relevant, but DEVONthink's SDEF file doesn't appear to be located in the usual place as most applications (i.e., it's not located in the app's Contents/Resources/ folder). See screenshot below.

 

image.thumb.png.20b79cb32b4c34c659b14e3a7060cec8.png

 

Path: /var/folders/l1/_hr3npwn4nz5m9j85w9_6g4c0000gn/T/DEVONthink 3.sdef

 

I don't understand enough about how this works, but when you close the window above (for the DEVONthink library) the sdef file also automatically deletes itself from that location. It's odd.

 

To see if it changed locations, I removed DEVONthink's library from Script Editor, and then added the app back ... and its SDEF always appeared at this location (i.e., when open - otherwise it magically disappears from that location).

Edited by Jasondm007
Posted

Indeed that will be the cause. I’ve poked a bit around the app but didn’t find it either. If you’re able to contact them and get how they’re storing it, I may be able to add support for it in the workflow (using that folder won’t work, because it’s not a fixed path for all users).

Posted
3 hours ago, vitor said:

Indeed that will be the cause. I’ve poked a bit around the app but didn’t find it either. If you’re able to contact them and get how they’re storing it, I may be able to add support for it in the workflow (using that folder won’t work, because it’s not a fixed path for all users).

 

Thanks for taking a look at it, @vitor!! I'll reach out to their developers to see where it's being stored.

Posted

Hi @vitor - This week, I ran several searches on my computer to try and track down DEVONthink's sdef file (e.g., sudo find / -name *.sdef -print 2>/dev/null). However, I was never able to locate it (i.e., beyond the temp one mentioned above).

 

DEVONthink's development also confirmed the lack of an sdef file yesterday. They indicated that it relies on an older suite of files that are internal to the package:

  • /Applications/DEVONthink 3.app/Contents/Resources/DEVONthink 3.scriptSuite
  • /Applications/DEVONthink 3.app/Contents/Resources/DEVONthink 3.scriptTerminology

By chance, is it possible for your workflow to use these files? I suspect that I know the answer, but I thought I'd ask. Thanks!

Posted
2 hours ago, Jasondm007 said:

They indicated that it relies on an older suite of files that are internal to the package:

  • /Applications/DEVONthink 3.app/Contents/Resources/DEVONthink 3.scriptSuite
  • /Applications/DEVONthink 3.app/Contents/Resources/DEVONthink 3.scriptTerminology

By chance, is it possible for your workflow to use these files? I suspect that I know the answer, but I thought I'd ask. Thanks!

 

Yeah, I found those when I poked around but unfortunately opening them didn’t work like with sdefs.

Posted

As a quick fix, you could create the sdef for dt3 in the terminal. Then you just have to move it to a place where the workflow can detect it.

 

sdef /Applications/DEVONthink\ 3.app > DEVONthink3.sdef

 

Posted
On 2/22/2023 at 12:07 PM, zeitlings said:

Then you just have to move it to a place where the workflow can detect it.

 

Not exactly, because the workflow also depends on knowing where the app is so it can show the proper name and icon.


But the sdef command is a good idea! I can’t just make it work for DEVONthink and other apps though because running it always opens the app. Which is a weird experience if your cache is rebuilding and suddenly a bunch of apps open. I went back and forth with a few options and ultimately decided on a Universal Action approach.

 

@Jasondm007 Please update from within Alfred and try the new version. Use the Generate AppleScript Dictionary action on DEVONthink and it’ll show up in the workflow from then on.

 

I’ve also removed the :applescriptdictionariesforceupdate in favour of updating with fn↩ on any result.

Posted

Sorry for the slow response, @vitor. Thanks for updating the workflow! This is awesome!!

 

Unfortunately, I received the following error when trying to generate a dictionary for DEVONthink:

 

Error.thumb.png.ae939a2cfb8f97b1a65ab8eaa46031ea.png

 

Am I correct that this new action in the workflow requires Xcode to be installed? I uninstalled Xcode a long time ago from my machine. But I guess I could always add it back again to get this part of the workflow up and running. 

 

Thanks again for all of your help!

Posted

Indeed it looks like it needs the full Xcode for that part of the workflow to run. Kind of a heavy requirement but not much we can do. If you uninstall it after the dictionary creation, it should continue to work.

  • 1 month later...
Posted

Updated to 2023.3.

  • Change cache rebuild shortcut to ⌘⌥⌃↩.
  • Replace deprecated readDataToEndOfFile with readDataToEndOfFileAndReturnError.

Posted

Updated to 2024.1.

  • Increase speed of cache creation with Swift rewrite and mdquery search.
  • Use caching from JSON.
  • Remove cache busting.
  • Skip Input as Universal Action.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...