Open URL of PDF in DT window?

I’m trying to open the original URL of a captured PDF in DT, but not sure how (if) this could be achieved. I’ve tried this:

tell application id "DNtp"
	repeat with theRecord in (selection as list)
		set theURL to URL of theRecord
		do JavaScript "window.location='" & theURL & " ';" in think window 1
	end repeat
end tell

Probably this doesn’t work because think window 1 is not a browser when viewing a PDF (so do Javascript does not work). Any ideas how I could make this work?

It works when opening the URL in an extra tab:

tell application id "DNtp"
	repeat with theRecord in (selection as list)
		-- Only do this when there isn't already an extra tab open
		if (count tabs of think window 1) < 2 then
			set theURL to URL of theRecord
			open tab for URL theURL in think window 1
			set current tab of think window 1 to (last tab of think window 1)
		end if
	end repeat
end tell

Currently setting the URL of a window/tab is only possible if a web page is already shown. But the next release will support simple scripts like this one:

tell application id "DNtp"
	set theWindow to think window 1
	set theRecord to content record of theWindow
	set URL of theWindow to URL of theRecord
end tell
2 Likes

Great! When you mention ‘next release’ do you mean next minor (3.8.3) or major release?

There won’t be a major one anytime soon.

Just confirming this now works in 3.8.3 - thanks @cgrunenberg !