How to open Preview or Skim from DEVONThink

Unfortunately, DEVONThink utilizes its own PDF preview application. If you’d rather want to open Preview, you can utilize BetterTouchTool and set up a custom action for DEVONThink for a keyboard combination to use.

bttpreviewfromdt

The attached script could do something like this (you’d have to internationalize the menu labels):

tell application ":Applications:DEVONthink Pro.app"
	set pdfFile to the content record of the think window 1
	set RecordLink to the reference URL of pdfFile
	set PdfPage to current page of the think window 1
	set DevonThinkLink to RecordLink & "?page=" & PdfPage
	set the clipboard to DevonThinkLink
	set PdfPath to get the path of pdfFile
	set PdfPath to (POSIX file PdfPath) as Unicode text

	tell application "Preview" to activate

	tell application "System Events"
		tell process "Preview"
			open PdfPath
			set frontmost to true
			tell menu bar 1
				tell menu "Gehe zu"
					click
					tell menu item "Gehe zu Seite …"
						click
					end tell
				end tell
			end tell
			tell window 1
				tell sheet 1
					tell text field 1
						set PdfPage to PdfPage + 1
						set value to (PdfPage as text)
					end tell
					tell button "OK"
						click
					end tell
				end tell
			end tell
			tell menu bar 1
				tell menu "Darstellung"
					click
					tell menu item "Miniaturen"
						click
					end tell
				end tell
			end tell
		end tell
	end tell
end tell

 

A similar script, for opening Skim, could work like this:

tell application ":Applications:DEVONthink Pro.app"
	set pdfFile to the content record of the think window 1
	set RecordLink to the reference URL of pdfFile
	set PdfPage to current page of the think window 1
	set DevonThinkLink to RecordLink & "?page=" & PdfPage
	set the clipboard to DevonThinkLink
	set PdfPath to get the path of pdfFile
	set PdfPath to (POSIX file PdfPath) as Unicode text

	tell application "Skim"
		activate
		open file PdfPath
		set PdfPage to PdfPage + 1
		go document 1 to page PdfPage of document 1
	end tell
end tell
Share