One-click way to open current Safari Tab in DTPO

Sometime when I’m reading a page in Safari I want to immediately continue with that page in DTPO to make it more convenient for note taking, etc. Looking for a one-click approach, because I’m too lazy to fuss with making a bookmark with Clip To DEVONthink, looking up the bookmark and opening a window in DTPO, I use one of the following scripts.

The first script asks where you want to put a bookmark made from the URL of the current Safari tab, makes the bookmark, then activates a DTPO window with that page.


property pURL : ""
property pName : ""

tell application "Safari"
	set pURL to URL of current tab of window 1
	set pName to name of current tab of window 1
end tell

tell application id "com.devon-technologies.thinkpro2"
	open window for record (create record with {name:pName, URL:pURL, type:bookmark} in display group selector)
	activate
end tell

The second script does the same thing, but makes a paginated PDF instead (e.g., if you want a one-click method to get right to work annotating):


property pURL : ""
 
tell application "Safari"
	set pURL to URL of current tab of window 1
end tell

tell application id "com.devon-technologies.thinkpro2"
	open window for record (create PDF document from pURL in display group selector with pagination)
	activate
end tell

Put the scripts in the global Scripts menu on your machine (usually in ~/Library/Scripts)

1 Like

thanks for the scripts! Another possibility is to use a workflow service executing an AppleScript like this one:


on run {input, parameters}
	repeat with theURL in input
		tell application id "com.devon-technologies.thinkpro2" to open tab for URL theURL
	end
	return input
end run

Install the workflow named “Open URL in DEVONthink Pro” in ~/Library/Services (or by double-clicking on the saved workflow on Lion), afterwards this command can be found e.g. in Safari’s service menu after selecting the page’s address.

Put the scripts in the global Scripts menu on your machine (usually in ~/Library/Scripts)
[/quote]
Hello Korm!

Thanks! this looks cool! so how can I activate the script in Safari?

sincerely,

-D

AppleScript experts: would someone please show me how to modify this script to not display the group selector (just go to global inbox) and to not open the window, in other words just save the bookmark to the global inbox?

Change (for example):

open window for record (create PDF document from pURL in display group selector with pagination)
	activate

to

create PDF document from pURL in incoming group with pagination

The incoming group is whatever you’ve defined in Preferences > Import > Destination

Korn,

How would I modify it too…

Save current Tab and display group selector?

I edited and it does what I want but on the DevonThink icon it doesn’t show ‘new entry’ (red dot) nor does the file show as “unread”(grey dot)

This is what I have.


property pURL : “”

property pName : “”

tell application “Safari”

set pURL to URL of current tab of window 1

set pName to name of current tab of window 1

end tell

tell application id “com.devon-technologies.thinkpro2”

create record with {name:pName, URL:pURL, type:bookmark} in display group selector

end tell

It won’t, since you looked at it.

The answer to your other question is above.

Ah, got it, I see just use the inner argument. Thanks.

Sorry, I wasn’t clear what I was looking for.

Saving the current Tab and choosing from the group selector, I don’t want the window to come up after I have saved the URL.

The script I edit works fine with…
Executing the script, fine!
Brings up the display group selector, Fine!
Saves the URL, fine!
Doesn’t bring up the saved url window, fine!

BUT it doesn’t show new entry (+1) on the DevonThink icon nor does it show unread(grey dot) on the file.

Thanks.

Why is that needed? Sorry, I don’t get the point. I suppose you could try

set theRecord to create record with {name:pName, URL:pURL, type:bookmark} in display group selector
set unread of theRecord to true

I suggest getting familiar with the DEVONthink scripting dictionary via your script editor.

Thanks Korn.

Now the ‘unread’ (grey dot) shows :slight_smile:
The (+1) on the icon still doesn’t show but it’s ok not a big deal.

Didn’t even know the DevonThink dictionary existed in the script. lol Good to know.

Thank you again kron :slight_smile:

No problem.

(It’s @korm not “korn, krom, kron…”

I got it the first time :wink:

The last entry was autocorrect lol