Script Debugger 8.0.4: make new document with properties

After the update to 8.0.4 this script doesn’t work anymore, newDoc returns missing value:

tell application "Script Debugger"
	try
		set theHeader to (script "Create Script Header"'s createScriptHeader(true)) & linefeed & linefeed
		set newDoc to make new document with properties {source text:theHeader}
		
		tell newDoc
			set bounds of its window to {967, 412, 1592, 1028}
			set selection to {10, 0}
			set show code folding to false
			compile
		end tell
		
		activate
		
	on error error_message number error_number
		if the error_number is not -128 then display alert "Script Debugger" message error_message as warning
		return
	end try
end tell

However, it does work like this:

tell application "Script Debugger"
	try
		set theHeader to (script "Create Script Header"'s createScriptHeader(true)) & linefeed & linefeed
		set newDoc to make new document
		
		tell newDoc
			set source text to theHeader
			set bounds of its window to {967, 412, 1592, 1028}
			set selection to {10, 0}
			set show code folding to false
			compile
		end tell
		
		activate
		
	on error error_message number error_number
		if the error_number is not -128 then display alert "Script Debugger" message error_message as warning
		return
	end try
end tell

Script Debugger 8.0.4
macOS 10.14.6 (Intel)

This code works for me:

tell application "Script Debugger"
	try
		set theHeader to "Testing"
		set newDoc to make new document with properties {source text:theHeader}
		
		if newDoc is missing value then set newDoc to first document -- workaround for regression
		
		tell newDoc
			set bounds of its first window to {967, 412, 1592, 1028}
			set selection to {10, 0}
			set show code folding to false
			compile
		end tell
		
		activate
		
	on error error_message number error_number
		if the error_number is not -128 then display alert "Script Debugger" message error_message as warning
		return
	end try
end tell

There is a problem we’ll resolve where the make new document event returns missing value when it should return a reference to the newly created document.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.