A search revealed some tantalizing stuff, but no smoking gun…
I’m having trouble getting the following (simple) script to run as an attached script:
display dialog "Your favorite color is Grey"
It’s saved as a compiled script (data fork) ie .scpt file. When I click on the file it’s attached to in 3-pane view, or double-click on the document, I get no dialog with my message.
(Script seems to work as an attached script in Omnigraffle, FWIW)
As an aside, when I first tried to get this to work, I noticed the following: suppose I write a script, call it “first.scpt”. In it I forget to write the “on triggered” part (clearly on purpose ), so it doesn’t work as a triggered script. I try a couple of times to open the record to which it’s attached, nothing happens, I realise what is going on and add the “on triggered” part. Does it work now? No it doesn’t. But if I copy it) and attach the copied script (which is exactly the same), it works. Also if I restart DT. So DT apparently doesn’t reload the script if it’s changed.
How elegant! Anyway, just a heads up in case anybody else wastes his time working out what’s going on here.
Looks like the “Update Scripts Menu” selection in the DTPO Applescript menu will update everything without having to restart, or whatever…
I think this might be a side-effect of Applescript’s persistence once an instance is setup, and not some dorky aspect of DTPO. IF DTPO calls a script and Applescript sets up an instance around it, then you edit and recompile your script outside that instance, neither the Applescript instance nor DTPO knows about what you’ve done.
(Perhaps the DEVONthinkers could rename their menu selection to “Update Scripts,” though!)
Aha, thanks! That greatly simplifies debugging my attachable scripts… I missed it because I don’t use the script menu (I use fastscripts), so I simply didn’t even see it…
Maybe. BBEdit, Mailsmith and other programs don’t do this, but then maybe there’s something about the attached scripts. At any rate, in normal use it’s not important, so I guess there wouldn’t be any reason to devote much time to it anyway.
I don’t have the “Update Scripts Menu” item in my DTPO scripts menu. Where can I get a copy of that? It’s tiresome having to repeatedly restart DTPO to have script changes take effect.