Who is running an Applescript if it is called from the script menu?

I have a long running script which I start from the Script menu (the one to the left of the DT3 Help menu).

After a while it looks like it has stalled, but I don’t know how to check. Who is running that script? Can I find it via ps or in the Activity Monitor?

Also, all other scripts under the Script menu stay grayed out. The only way I could get the entries back to normal is quitting DT3. Is there a gentler way to do this (e.g. killing just the script)?

DEVONthink only runs on script at a time, hence the others can’t be run.

What’s your code doing?

The code has a list of URLs and for each of the URLs the script does a search in DT3 and if there’s no document found it creates a webarchive in a specific group. I guess this script sometimes starts to hang if the download does not complete in 60sec…

I can live with that (because I can just restart the script), but I would like to find a smoother way to kill the script. So who is running the script: DT3 directly or Applescript Runner?

DEVONthink 3. Could you please post the code of the script?

Thanks.

1) To your answer: So DT is running the script. Does DT has away to tell the running script to quit (similar to Applescript Runner)?

2) To your question: The script is called PBImport.scpt and you can download it here. It is a custom version of the Pinboard Importer (in development - the filing of an additional bookmark into the subgroup /Pinboard/elsewhere/ for found pages doesn’t work yet as expected).

No.

I couldn’t spot any issues immediately. How many items does your Pinboard account contain? However, you could add a timeout to the script by enclosing the System Events block like this:

with timeout of 60 seconds
	tell application "System Events"
		...
	end tell
end timeout

Will try the with timeout… The hanging is really strange. Would like to get to the bottom of it!

I have 5000 plus items in Pinboard, so I don’t expect this will run through in only one or two goes. :slight_smile:

I’ve started using with timeout (with a 10min timeout) - and it works pretty well: All the downloads seem to finish now.

Thanks for the tip!