Timeout error appears instantly

This is odd. The script below works well and quickly, but when it finishes running I’m always getting an appleEvent timed out error in SD when running it from SD’s script menu.

The entire scripts execution is doesn’t take enough time for that error, much less a single command and there’s no with timeout block.

If I open it and run it in SD or SE no error. Also if I run it from the system scripts menu, no error. Only from the SD scripts menu.

(This is the same script that would ignore the open dictionary parameter and ask the user to open the dictionary or the script, and that bug was fixed. I’m certain this has worked without the error since that bug was fixed. (I would have noticed and reported it).)

use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions

set scriptLibrariesFolder to path to library folder from user domain as text
set scriptLibrariesFolder to scriptLibrariesFolder & "Script Libraries:"
set myScriptLibraries to my GetFileNames(scriptLibrariesFolder, "scptd")

set listTitle to "Script Libraries"
set listPrompt to "Which script dictionary would you like to try to open?"
set okbuttonName to "This One"
set multipleSelections to true
set emptySelectionAllowed to false
tell application "Script Debugger"
   
   set userChoice to choose from list myScriptLibraries ¬
      with title listTitle ¬
      with prompt listPrompt ¬
      OK button name okbuttonName ¬
      multiple selections allowed multipleSelections ¬
      empty selection allowed emptySelectionAllowed
end tell
if userChoice is false then return
set scriptList to {}
repeat with thisScript in userChoice
   set the end of scriptList to ((scriptLibrariesFolder as text) & thisScript as text) as alias
end repeat

repeat with thisScriptLibrary in scriptList
   tell application "Script Debugger"
      set myLib to open thisScriptLibrary showing script dictionary
   end tell
end repeat

on GetFileNames(folderWithFiles, fileExtension) -- @other stuff
   set folderWithFiles to POSIX path of (folderWithFiles)
   set thePaths to current application's NSFileManager's defaultManager()'s contentsOfDirectoryAtPath:folderWithFiles |error|:(missing value)
   set fileNames to (thePaths's pathsMatchingExtensions:{fileExtension}) as list
   return fileNames
end GetFileNames

This is a known problem with calling Script Debugger’s open command from a script being run by SD. (In fact, I think you first reported it.) We hope to have a fix, but there are some complications involved.

Got it. I might have reported it or seen someone report because something seemed familiar. I did a search here for timeout on the forum and didn’t find it.