--http://www.organognosi.com
tell application "DEVONthink Pro"
set nameCurrentPDF to name of content record of window 1
set targetgroup to parent of content record of window 1
set AppleScript's text item delimiters to {""}
set charFullStop to character -4 of nameCurrentPDF
if charFullStop is "." then set nameCurrentPDF to characters 1 thru -5 of nameCurrentPDF as string
display dialog "Enter bookmark name:" default answer nameCurrentPDF buttons {"Send bookmark to current group", "Select the target group", "Cancel"} default button 2
copy the result as list to {nameBookmark, selectedDestination}
set DEVONthinkPageNum to current page of window 1
set realCurrentPageNum to DEVONthinkPageNum + 1
set DEVONthinkPage to DEVONthinkPageNum as text
set realCurrentPage to realCurrentPageNum as text
set fileLink to the reference URL of content record of window 1
if selectedDestination is "Send bookmark to current group" then
create record with {type:bookmark, name:nameBookmark, URL:fileLink & "?page=" & DEVONthinkPage} in item 1 of targetgroup
else if selectedDestination is "Select the target group" then
create record with {type:bookmark, name:nameBookmark, URL:fileLink & "?page=" & DEVONthinkPage} in display group selector
else if selectedDestination is "Cancel" then
--do nothing
end if
end tell