I have a very basic AppleScript question that I’m ashamed to ask, given how simple it seems, but that I have somehow made overly complicated.
In short, I’d like to know how to activate a DEVONthink window that’s already open using AppleScript. The catch is that it has to work across different desktops/spaces (i.e., so that if the window is open on a different desktop/space from where you’re currently working that your screen will automatically shift to that desktop/space), and it also needs to work for both document and viewer windows.
I’ve been toying around with this for quite some time, but I haven’t quite come up with something that works under both conditions described above. If you’re curious, it’s part of an Alfred workflow that I’d like to start using more (And, yes, I’ve used app switchers, like Witch, and am just looking to accomplish this through something homegrown).
Because I think I’ve made this issue overly complicated, let me ask a more basic question: How can I use a think window id number to activate/bring-to-front a given DEVONthink window?
For example, at the moment, I have two open think windows: a document window and a viewer window. And here’s the output from Script Editor:
Now, let’s say that I want to activate/bring-to-front the viewer window with the id of 34099. In other words, assume that you know you want window id 34099 from a prior step or input (like from Alfred, etc.). How can I use the window ID number 34099 to activate/bring-to-front that specific window via AppleScript? Is there a generalizable approach that will work for document and viewer windows (e.g., so that if I gave you id 29150, from the example above, that it would also work for that document window)?
Thanks a ton for any help you can lend! Thanks for helping this scripting neophyte out!!