Opening exactly the same window

No, you got it wrong. The script is doing what it should do. Jim wrote:


This script duplicates the first main window (viewer window).

Note: Because there’s no root we could use to duplicate the window the script throws an error in any of these cases:

  • if there’s more that one group selected in the navigation sidebar
  • if the window’s root is a Smart Rule
  • if the window’s root is a global Smart Group
  • if the window’s root is the trash container group
-- Duplicate viewer window

tell application id "DNtp"
	try
		if not (exists viewer window 1) then error "Please open a viewer window"
		set theWindow to viewer window 1
		try
			set theRoot to root of theWindow
			set theRoot to theRoot
		on error
			error "This script doesn't work with a multiple sidebar selection, a global Smart Group or a Smart Rule"
		end try
		set theSelection to selected records of theWindow
		set theBounds to bounds of theWindow
		set theBounds_cascaded to {(item 1 of theBounds) + 22, (item 2 of theBounds) + 22, ((item 3 of theBounds) + 22), (item 4 of theBounds) + 22}
		
		set theNewWindow to open window for record theRoot with force
		set selection of theNewWindow to theSelection
		set bounds of theNewWindow to theBounds_cascaded
		activate
		
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink" message error_message as warning
		return
	end try
end tell
  • Open Script Editor.app (e.g. via Spotlight)
  • Paste the script
  • Save as scpt file
1 Like