Salvete omnes,
Is there a way for me to copy the page link along with custom metadata from fields x, y and z? The default behavior with “Get Page Link” is to copy file name along with the link. Instead, I wish to get text from the custom metadata fields and the link. My goal is to have data from fields such and author, date and title automatically copied and perhaps have a prompt pop up in order to input page number.
I know apple script is the way to go about this, but I could not find any script to copy the page link in DT3 to work with. Any help whatsoever is much appreciated.
No this is not possible with a single command, and yes, an AppleScript would be the likely candidate.
This is a simple approach…
tell application id "DNtp"
repeat with thisRecord in (selection as list)
if (type of thisRecord) is PDF document then
set currentPage to (current page of think window 1) -- This is zero-indexed, so page 20 is page=19. If you are going to use the page in text, you need to increment it plus one.
set recURL to reference URL of thisRecord
set xref to (recURL & "?page=" & currentPage)
set customMD to custom meta data of thisRecord
mdprice of customMD -- md prefixing the identifier from Preferences > Data
end if
end repeat
end tell
Thanks a lot, Jim @BLUEFROG.
Question: Is this supposed to work as is?
I changed mdprice to mdauthor and got the right result value on Script Debugger. However, when I run it, it doesn’t copy the link to the clipboard and I can’t seem to find a way to include other mdvalues.
Sorry if this is trivial. I’ve been fiddling with the dictionary and script debugger, but it’s not really my area of expertise.
I think I got it 
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application id "DNtp"
repeat with thisRecord in (selection as list)
if (type of thisRecord) is PDF document then
set currentPage to (current page of think window 1) -- This is zero-indexed, so page 20 is page=19. If you are going to use the page in text, you need to increment it plus one.
set o_HTML to ""
set recURL to reference URL of thisRecord
set xref to (recURL & "?page=" & currentPage)
set customMD to custom meta data of thisRecord
set mdauthor to (mdauthor of customMD)
set mdano to (mdano of customMD)
set o_HTML to o_HTML & quoted form of ("<font face=\"gentium plus\"><a href=\"" & recURL & "\">" & mdauthor & " " & "(" & mdano & ", p." & currentPage & ")" & "</a></font> </br>")
end if
end repeat
set RTFtheReference to (do shell script "echo " & o_HTML & " | textutil -stdin -stdout -inputencoding utf-8 -format html -convert rtf | pbcopy")
end tell
1 Like
Nice! If it works the way you hope, I’d call it a success (though it’s often fun to refactor our work, now or in the future - when you find embarrassingly bad code you wrote back then
)).
and I can’t seem to find a way to include other mdvalues.
Other mdvalues if applied to the current file would be listed from this line set customMD to custom meta data of thisRecord
.
Where’d you get the textutil
option - your own method?
I copied it from another script I found here at the forum 
This one, to be more precise. So, you see, I have no I idea how it works! I just played with it as if it were a puzzle and came up with this alternative.
I thought it looked familiar, and it’s not a bad bit of code. And playing is often the time when we make the greatest discoveries. Less pressure. True story.

Agreed! Once again, thanks for helping me get started!
Is there a similarly simple way to “paste” custom meta data into a record?
No.
If you search our AppleScript dictionary for meta data, you will find this command…
A quick lesson in automation:
Generally, you shouldn’t think of automation as following physical steps like that. You may think, “I could paste things in…”, but the behaviors of computers and people are two very different things.
Similarly, it’s rarely a good approach to try and make it do things like push buttons or select things. It’s fragile so it can be broken fairly easily and often also suffers timing issues.
Thanks. I thought possibly that just as a variable could be set, in whole, to a record’s custom meta data, that given a properly formatted variable, the variables values could be applied to a record’s custom meta data in whole, rather than each custom meta data field being set individually.
I used the word “paste” in quotes very generically, thus the quotes, as a reference to the “Copy…custom metadata” in the thread’s title. (But I may be missing the implications of your lesson. No need to elaborate, however. You have much bigger (and many) fish to fry.)
1 Like