Create universal indexes for your own books and papers
Almost every academic book has at the end of it an index ,which helps the reader find in it pertinent material regarding the indexed words or phrases. Using a more technical terminology, I can say that an index is a list of “dead” analog internal links (If you want to make them active you can use AutoBookmark, but this is for another post).
Nowadays it is quite probable that any young academic researcher has accumulated a considerable amount of academic sources in PDF format. If he uses Mac computers, DEVONthink and Skim from now on he can create universal indexes. By universal indexes I mean that the active links are not internal to a specific source but external to any document that contains the indexed word or phrase and is in a DEVONthink database. You can see an example of a part of a universal index in MediaWiki format in the following image:
The above text is produced automatically and you can see in it some of the conventions that I use in my workflow. For example the names of my PDF files follow the pattern “title – last name” and the corresponding MediaWiki page hat the “@” in front of the PDF name. The links named “correct logic” open the corresponding source in DEVONthink and all the instances of “correct logic” are highlighted. An example of a URL of these links is the following: x-devonthink-item://A6A8BAC2-B6E7-4568-A117-C74335C4C7BC?search=correct_logic.
Some advantages of universal indexes are the following:
- You can immediately see all the instances of the indexed word or phrase which are in each document.
- You can copy a part or the whole of it in one or more documents.
- You can freely annotate the index because it is just plain text. For example sometimes I find it quite useful to copy and paste the relevant excerpt from each page as is shown below:
The AppleScript which can create universal indexes is the following:
The result is sent to the clipboard. The script is generally slow especially when there are a lot of matched documents. The index is created either in MediaWiki format or RTF format.
Create DEVONthink bookmark for the current PDF page
The AppleScript which performs this function is the following:
The bookmark is created for the current PDF page in the frontmost DEVONthink window. After executing the script, the following window is shown:
You can set the bookmark name and choose the group in which the bookmark will be sent.
Special thanks to R.K. for providing ideas and support for the development of this script.
Integrate Microsoft Word with DEVONthink
As you may have noticed, DEVONthink links are not properly recognized by Microsoft Word.
First of all, when you have one of them (e.g. the “x-devonthink-item://14AE6E1A-DB3E-429B-8A46-4E1C3174A6F2?page=23″) in the clipboard by using the “Copy Page Link” DEVONthink command and paste it to a Word document, you do not get a proper hyperlink but you just see the raw URL. Moreover, when you try to create a Word hyperlink using the normal procedure, (Insert -> Hyperlink… or Command + K) the DEVONthink URL is changed to a degree that cannot be recognized and used by Word. Specifically, after inserting it in the “Link to:” field of the “Insert Hyperlink” Word window

it is converted to “file://localhost/x-devonthink-item/::14AE6E1A-DB3E-429B-8A46-4E1C3174A6F2%3Fpage=23″.
Fortunately the changes are not so destructive and the link can become functional using… what else, an AppleScript!
The only requirement for the proper execution of the script is to have either the cursor inside the hyperlink or the hyperlink should be selected with or without any of its adjacent text. If more than one hyperlinks are in the selected text then the first link will be activated by the AppleScript.
The AppleScript code for activating a link in Word is the following:
Click here to open the source code in AppleScript Editor
Now that we can use DEVONthink links in Word it is time to automate the creation of Word hyperlinks! The new hyperlink will have as destination the selected item in DEVONthink and it is created at the cursor position in the front Word document. The display text of the link follows the template: “(Name of DEVONthink record)” or “(Name of PDF file: Page Number)”.
The AppleScript code which creates Word links to a DEVONthink record is the following:
Count the number of pages of selected PDF files in your DEVONthink database
I wrote the following AppleScript in order to satisfy my curiosity about this number!
MediaWiki, Mac and custom URL schemes
A lot of Mac applications have their own URL schemes. In the following table you can see some examples of custom URL schemes:
| Application | Custom URL scheme |
| Evernote | evernote:// |
| DEVONthink | x-devonthink:// |
| BibDesk | x-bdsk:// |
| OmniFocus | omnifocus:// |
| VoodooPad | x-voodoopad-item:// |
| TextMate | txmt:// |
If you want to see all URL scheme handlers on your system you can install the freeware app RCDefaultApp. Also handleopenurl.com maintains a URL scheme index of more than 600 iOS apps.
Custom URL schemes are extremely valuable because you can address specific data of an application by using them. They are the basic building blocks of all hyperlinks. In my post “Automated summary creation linked with the source PDF file” you can see how I use x-devonthink URL schema in order to connect my notes with the source PDF file.
Moreover, as you can see in my post “Embed AppleScripts in a MediaWiki page” there is a custom URL scheme for AppleScript! In my next posts I will publish a series of AppleScripts, which use the “applescript://” URL scheme.
MediaWiki can recognize all these custom URL schemes if you add the following lines in the LocalSettings.php file:
$wgUrlProtocols[] = “evernote://”;
$wgUrlProtocols[] = “devonthink://”;
$wgUrlProtocols[] = “x-bdsk://”;
$wgUrlProtocols[] = “omnifocus://”;
$wgUrlProtocols[] = “x-voodoopad-item://”;
$wgUrlProtocols[] = “txmt://”;
$wgUrlProtocols[] = “applescript://”;
You can see my post “How to use DevonThink links in a MediaWiki page” for more detailed information.
Send DEVONthink tags to BibDesk as keywords
Convert DEVONthink tags to MediaWiki categories
[[Category:tagName]]
As I did not want to insert manually the tags for each source twice I wrote an AppleScript, which converts DEVONthink tags to MediaWiki categories. One item should be selected in DEVONthink before executing the script. The result is sent to the clipboard.
The AppleScript code is the following:






