ScriptDebugger is hung

Using version 7.0.8 of Script Debugger on High Sierra – I was debugging a program and had to force quit Script Debugger as it was hung and Activity Monitor said it was not responding and when I tried to restart SD it is now hung and won’t do anything. Have attached a sample of what Activity Monitor shows. Have logged out and then in again with same result and then rebooted system and logged in and same result.

How to get things working again??

Thanks…

Can’t paste the sample as it’s too big so am trying to upload it as a file (it’s about 200K and appears limit for a topic is 64K). Plus had to compress it as filetype of “log” not allowed.script-dugger.sample.log.zip (32.4 KB)

Can I download SD version 6 and see if it will work – I am completely dead in the water and can’t do anything in SD7? I entered my SD7 serial number but only version 7 seems to be downloadable. Please help as I can’t do anything and am completely stuck with trying to work on my program. SD6 says it will run in High Sierra, so that is a possibility, correct?

Thanks…

Thanks for including the sample report, it provides some clues to the cause of the hang you are experiencing.

It appears that the hang is happening as AppleScript tries to locate an application. What may be happening is there is a reference to an application within your script (or a script object within your script) that does not reside locally on your system. AppleScript can sometimes take a very long to locate such applications because it has to search all your server volumes.

Another possibility is the Launch Services database on your Mac is damaged. You can try rebuilding that and see if the problem corrects its self.

This is all being triggered by Script Debugger’s variable explorer which is trying to display your script’s variables. You can work around this issue by hiding the Results & Variables tab (click on the Results & Variables control twice):

53%20PM

Then, switch to the Result Var (see the View > Show Result Bar command) to display the result of your script textually.

The program does have a tell block for “Safari” – is this what you consider a “reference to an application”?

Just for completeness sake this is an application type of AppleScript (program.app). Since ScriptDebugger is hung I don’t seem to be able to do anything (like get a listing of the program) … any suggestion on how to do that? I’ve looked in all the folders inside the .app folder and found a folder named “Scripts” in the “Resources” folder that contains a file named “main.recover.rtf” and opened it with TextEdit and this is what it shows:

set question1 to ""
set question2 to ""
set sortedtabnamematchlist to {}

set AppleScript's text item delimiters to ""

repeat while question2 = ""
	
	set question1 to display dialog ("Would you like to search or list Safari tabs?") buttons {"List", "Search"} default button "Search"
	set mode to button returned of question1
	
	set question2 to display dialog ("Find Safari tab:") default answer ""
	set searchpat to text returned of question2
	
	with timeout of 2000 seconds
		
		tell application "Safari"
			set winlist to every window
			set winmatchlist to {}
			set tabmatchlist to {}
			set tabnamematchlist to {}
			repeat with win in winlist
				set ok to true
				try
					set tablist to every tab of win
				on error errmsg
					--display dialog name of win as string
					set ok to false
				end try
				if ok then
					repeat with t in tablist
						if searchpat is in (name of t as string) then
							set end of winmatchlist to win
							set end of tabmatchlist to t
							set end of tabnamematchlist to (id of win as string) & "." & (index of t as string) & ".  " & (name of t as string)
							--display dialog name of t as string
						else if searchpat is in (URL of t as string) then
							set end of winmatchlist to win
							set end of tabmatchlist to t
							set end of tabnamematchlist to (id of win as string) & "." & (index of t as string) & ".  " & (name of t as string)
							--display dialog name of t as string
						end if
					end repeat
				end if
			end repeat
			if (mode = "Search") then
				--we are in "Search" mode
				if (count of tabmatchlist) = 1 then
					--display dialog "one!"
					set w to item 1 of winmatchlist
					set t to item 1 of tabmatchlist
					set current tab of w to t
					set index of w to 1
				else if (count of tabmatchlist) = 0 then
					display dialog "No matches -- To try again, select 'Cancel' button"
				else
					-- sortedtabnamematchlist = my simple_sort(tabnamematchlist)
					considering numeric strings
						set sortedtabnamematchlist to my sortList(tabnamematchlist)
					end considering
					set whichtab to choose from list of sortedtabnamematchlist with prompt "The following Safari tabs match, please select desired tab or select 'Cancel' button to start another search:"
					
					set prevTIDs to AppleScript's text item delimiters
					set AppleScript's text item delimiters to {"."}
					if whichtab is not equal to false then
						set tmp to text items of (whichtab as string)
						set w to (item 1 of tmp) as integer
						set t to (item 2 of tmp) as integer
						set current tab of window id w to tab t of window id w
						set index of window id w to 1
					end if
					set AppleScript's text item delimiters to prevTIDs
				end if
			else
				--we are in "List" mode
				if (count of tabmatchlist) = 1 then
					--display dialog "one!"
					set w to item 1 of winmatchlist
					set t to item 1 of tabmatchlist
					set current tab of w to t
					set index of w to 1
				else if (count of tabmatchlist) = 0 then
					display dialog "No matches -- To try again, select 'Cancel' button"
				else
					-- sortedtabnamematchlist = my simple_sort(tabnamematchlist)
					considering numeric strings
						set sortedtabnamematchlist to my sortList(tabnamematchlist)
					end considering
					
					--set sortedtabnamematchtext to items of sortedtabnamematchlist as text
					display dialog sortedtabnamematchlist
				end if
			end if
			
		end tell
		
	end timeout
	
	set question2 to ""
	
end repeat

on sortList(thisList)
	local indexList, sortedList, lowItem, a, currentItem, lowItemIndex
	set indexList to {}
	set sortedList to {}
	repeat (length of thisList) times
		set lowItem to ""
		repeat with a from 1 to (length of thisList)
			if a is not in indexList then
				set currentItem to item a of thisList --- need to have "as ????" so that numbers sort correctly
				if lowItem is "" then
					set lowItem to currentItem
					set lowItemIndex to a
				else if currentItem comes before lowItem then
					set lowItem to currentItem
					set lowItemIndex to a
				end if
			end if
		end repeat
		set end of sortedList to lowItem
		set end of indexList to lowItemIndex
	end repeat
	return sortedList
end sortList

So does this have what you consider a “reference to an application”?

I had to force quit the Script Debugger.app program again and this time I got a crash report but don’t feel comfortable posting that here on public forum as I’m not sure if there is anything there that would be considered personal (it contains a lot of info not related to Script Debugger like other running processes, as well as system related info and ???) – do you know if that is the case or not (post output of crash reports to public forums like this)?? I would be willing to e-mail you this report separetely if you wish, so let me know how to do that?

I then I tried to rebuild the Launch Services database using this command:

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

and after several minutes it came back and then tried running Script Debugger again and it started by trying to create a new AppleScript program, which I canceled and then I did an Open Recent and selected the program I’m trying to work on and it then opens a dialog box that says "Reading FindSafariTab - v5.app … Generating Manifest and then I get the rotating beach ball indicating it’s hung again but the dialog box has a progress bar that is all blue with a “Stop” button but nothing else. Activity Monitor again says it’s not responding so back to square one and dead in the water.

As far as your suggestion to switch the Result Var to display the result of script textually, can’t do that as SD is hung, so any other suggestions? Do I again force quit SD and try again??

Thanks…

The source of the AppleScript program does not show correctly in this browser window, but looks fine when I’m editing the message – suspect something with the web server is doing incorrect formatting or ??? Am now uploading FindSafariTabs - v5.txt.zip (1.8 KB) the source as a compressed txt file so you can take a look at what it is…

Let me know if you would like any other info.

Had to upload another version of source as first had gotten corrupted somehow … this version should be better…

Thanks…

Update – well, source code now looks fine in the previous post, but no idea why all of a sudden it looks OK when before it was not. Safari issue or this website issue?

You can use the File > Recover Damaged Script command to open a textual version of your script. If you have the Remember Open Documents preference enabled, hold down the option key while launching Script Debugger to disable this setting.

Have you tried running the script in Script Editor to see if that hangs?

Hi

I am a new member and just a beginner in AppleScript . I just encountered the endless spinning beachball issue. I am writing a script (bundle script) with about 1000 lines (lots of comments) and test run many builds with no problem. In this last build, SD suddenly hangs when I was trying to fold block comment. I am not in debugging mode when I was doing that. I try to open the script in Apple script editor and there is no problem. Opening other scripts in SD don’t have the same issue. I tried reboot, reinstallation, copy from SE to SD, etc. But nothing work so far. Opening earlier build doesn’t have the issue.

I hope someone can give me some advise to resolve the issue.
Thank you in advance

Would you mind emailing the script to support@latenightsw.com ? Thanks.

I did. Thanks for the reminder.

EDITED. Don’t know the real reason but I have solved the issue by:
(1) Open the problematic script from Apple SE, and create a new empty script in SD.
(2) Copy the main program and each handler, one by one, from SE to the new script in SD
(3) Discovered that one handler always create the hung when it is copied to SD.
(4) Rename all vars in that handler in SE, and copy the handler to SD.
(5) Problem solved.

I am still eager to understand what has happened (probably something to do the internals that are saved after the script compilation?).

Thanks again