Script to Create Bookmark from Current URL

Is it possible to write an Applescript to take the current Chrome URL and then bring up the DT3 database tree, let me choose a particular Group, and create a bookmark to the URL, with the name of the bookmark set to the title of the web page?

(Yes, I know, that is what the DT3 web clipping extension does - but for some reason some URLs block that extension. Plus often I need an extra keystroke as well to grant “permission” to that extension. )

You might have to change Sarafi to chrome

property pName : ""

set the date_stamp to ((the current date) as string)
set NoteTitle to "URL List from Safari Tabs on " & the date_stamp

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 "DEVONthink 3"
	create record with {name:pName, URL:pURL, type:bookmark}
end tell

Thank you - I tried that for Chrome but it will not compile:

image

image

I suppose that Chrome has another AppleScript dictionary. So simply changing the application’s name might not be enough.

Indeed you are correct. For Chrome the term “current tab” needs to be replaced with “active tabe.”

Thanks to both of you.

Last question - Right now this works very well to place the new bookmark into the Global Inbox. How do I (a) Bring up the DT3 tree selector so I can choose the destination group? And how do I hard-code the script to place the bookmark into a specific desired destination group?

I found this in the AppleScript dictionary for DT:

set theResult to create record with record in record

No idea about showing the tree, though

1 Like

Found it:

image

So this works

image

Thanks @chrillek and @Hens

1 Like

Set Import>Destination>select group
you can then Name and Tag the file before saving

I have BBT and have a keyboard shortcut for safari, this shortcut contains the script. so all I do is hit the keys assigned and it brings up this. Even when DevonThink isn’t running(Script will bring it up) even the cursor will go to “search” all done with BBT.

If you want to save it to specific folder, make a smart rule like this.