All my posts (full-text)

  • Some tools of the trade February 12, 2011
    I use the following hardware:
    • a MacBook Pro 17in
    • a MacMini (as a server for my wikis and my ebooks library)
    • an iPad
    • a Time Capsule
    • an iPhone 3G
    • several external hard drives (for backup)
    • a 27in LG monitor

    In my academic workflow I use the following programs:

    • Skim: for reading papers and books (in pdf format)
    • Calibre: for organizing all my ebooks (read and unread)
    • DevonThink: for organizing everything that I have read
    • BibDesk: for reference management and automated bibliography creation
    • MediaWIki: for notes management
    • TextMate and LaTex: for writing my papers
    • AppleScript: for automating my workflow

  • It's all about hyperlinks! February 12, 2011

    If I was forced to choose the single most important element of my workflow then my answer would be the creation and usage of hyperlinks. We are all accustomed of using hyperlinks in the World Wide Web but I have observed that the usage of them in the personal mode of working is quite rare.

    A classic but somewhat outdated form of link is the bibliography reference that is commonly used in academic texts. Its main disadvantage is that you need a lot of time and energy to actually find and use the referred passage. Nowadays a different situation is possible by using hyperlinks.  

    I chose to use MediaWiki, DevonThink and Latex because they make the cross-linkage of my notes, my sources and my writings very easy and fast.

    Specifically lets say you have A and B wiki pages. If you want to create a hyperlink from A to B you just have to write [[B]] in the wiki text. The whole process is very well documented in the MediaWiki help page about links.

    The respective linking process with DevonThink is not well known and I think it is quite important. I even believe this capability of DevonThink to be a reason for academic researchers to switch to Mac computers!

    The DevonThink program assigns a custom Uniform Resource Locator (URL) for every file that is imported or indexed to it. An example of this URL is the following:

    “x-devonthink-item://6632BE51-AEDF-42F9-9CFD-BFED462EBC33″

    Moreover, in the case of a pdf file, a different URL is assigned to every single page of it. This URL takes the form:

    “x-devonthink-item://BB2D2CDA-0BCA-4F72-8C8E-64B49CA12839?page=0″

    As a result when you want to refer to the twenty fifth page of a pdf document you just have to use the URL:

    “x-devonthink-item://BB2D2CDA-0BCA-4F72-8C8E-64B49CA12839?page=24″

    Notice that the page number in the URL is 24 and not 25 as the index base that is used by DevonThink is zero and not one.

    You can send this URL to the clipboard by clicking “Copy Page Link” in the contextual menu.

    Then you can use this link in order to create a hyperlink to the exact pdf page! As a result all your bibliography references can be transformed to live links to the respective pages. No more you have to hunt down the source of a quotation!

    There is only one but…

    Not every word processor accepts the DevonThink links, the most prominent of them… Word.  This is an additional reason that I do not use Word…

    Some programs that are fully compatible with the DevonThink links are the following:

    In the above programs after you paste a DevonThink link you do not see the raw URL but the name of the linked file!

    Then you can edit the link as you like…

    Be careful only not to start the editing from the first or the last character of the file name.
    You can even edit the DevonThink link if you want to refer to a different page of the same pdf file.

    But the best thing is that you can use DevonThink link inside MediaWiki pages and Latex. If you want to learn how read my next post…

  • How to use DevonThink links in a MediaWiki page February 13, 2011
    MediaWiki supports out of the box a number of protocols for external linking such as HTTP, HTTPS, mailto, IRC. Additionally it gives you the possibility to add your own protocols by modifing the LocalSettings.php file under the root folder.I have installed MAMP in order to use MediaWiki and lets say that my wiki is named “MyWiki”. Then the path for this file in my file structure is (I use Snow Leopard):

    /Applications/MAMP/htdocs/MyWiki/LocalSettings.php

    So in order for MediaWiki to be able to understand DevonThinklinks you need to add the following line to the LocalSettings.php file:

    
    
    $wgUrlProtocols[] = 'x-devonthink-item://';

    Then when you write in the edit mode of a MediaWiki page:

    you just see

    a nice hyperlink after saving.

    Now MediaWiki and DevonThink are perfectly integrated! See a short demonstration in the following video.

    If you want to learn how the wiki text in the above video can be created automatically using Skim, AppleScript and Textmate read the following posts:

  • A road map for my blog - The many faces of links February 15, 2011
    In the following mind map you can see the various kinds of links that I am able to use and the respective programs that are required in order to create each of them. Moreover I have added some hyperlinks in the nodes for which I have posted relevant information.

    From A Digital Workflow for Academic Research

    You can download this mind map in its native Mind Manager file format from here  and as a PDF from here (right click + Save as).

    Finally, you can view this mind map as a roadmap for my blogspots… post by post I will try to present how you can create and use these different ways of cross-linking your thoughts, notes, writings and also your sources into an integrated whole!  

  • How to put DevonThink links in Skim notes February 20, 2011
    For every book or paper that I read I create a new page in my wiki. The name of this page is created under the following template: Title – Author, for example “Deconstructing the Laws of Logic – Clark”. In this page I keep all my notes and my thoughts concerning this paper. The pdf file is inside a DevonThink database. When I am reading a pdf I want to be able to use the DevonThink link without leaving Skim. To this end I wrote an AppleScript, which creates in the first page of the pdf four Skim notes, containing four different ways of constructing references using DevonThink links.

    The fourth note is the simplest and contains the DevonThink url (x-devonthink-item://CDEC17B7-1EEE-42E1-B8C9-86A24C172BF3?page=0). Its extended text contains the title of the wiki page.

    The third note contains a MediaWIki internal link to the wiki page of this pdf followed by an external link to the pdf file itself.

    The second note contains the necessary Latex code for creating a proper bibliography reference and a link to the exact pdf page using the hyperref package. The only things that are missing from the above code are the cite key (between the opening parenthesis and the colon) and the page numbers. As an example the complete second note is the following:

    (\cite{Deconstructing-the-Laws-of-Logic-Clark-2008a}: \href{x-devonthink-item://CDEC17B7-1EEE-42E1-B8C9-86A24C172BF3?page=}{})

    As you can notice the cite key “Deconstructing-the-Laws-of-Logic-Clark-2008a” is quite long. I have chosen this because I want to recognize the reference just by looking in its cite key and not by trying to remember for example which paper Clark wrote on 2008…

    The code for a bibliography reference to the third page of this paper which is in the 27th page of the Philosophy Journal is the following:

    (\cite{Deconstructing-the-Laws-of-Logic-Clark-2008a}: \href{x-devonthink-item://CDEC17B7-1EEE-42E1-B8C9-86A24C172BF3?page=2}{27})

    The first note contains the necessary MediaWiki code for creating a link to the excact pdf page which is compatible with LaTeX whenever you want to export the wiki text to Latex (more about this in a quite distant in time post…).

    Now every time I want to create a link to a pdf file everything is at hand in one of these notes!

    The AppleScript code which makes all the above possible is the following:

    2011-04-02
    In my post “How to create correctly the Skim notes which have the DEVONthink links, when you have already annotated the first page of the PDF document” there is an improved version of the above AppleScript. The newer one solves a problem which appears when you want a third AppleScript to use the aforementioned Skim notes like the AppleScript in my post “Automated creation of a LaTeX compatible citation only from Skim! (with hyperlink included)“. Moreover it creates a fifth note for which there is detailed information in my post “Latin page numbers, Arabic page numbers and the fifth Skim note“.

  • Automated summary creation linked with the source PDF file February 21, 2011
    One of the great characteristics of Skim highlights is that they capture automatically the highlighted text  in a newly created note.

    Moreover you can export these notes in a separate txt or rtf file.

    As a result an approximation of a summary is created if you highlight the appropriate text passages.

    Additionally if you have created the Skim notes with the DevonThink links as I described in the post “DevonThink links in Skim notes and AppleScript” you can use another AppleScript in order to have a properly formatted hyperlink from every highlighted text to the exact pdf page of the paper or book.

    When you copy this text to the respective wiki page of the paper or book you will have a nice hypertext between your summary and the source pdf file.

    You can see the seamless integration between the summary and the pdf in the following YouTube video.

    The AppleScript code is the following (updated):

    In order for the script to work you need to have TextMate installed in your Mac and an empty txt file open.

  • Go from the current PDF page in DevonThink to the same page in Skim March 6, 2011
    I prefer reading my PDF files in Skim. Moreover all my read PDF files are inside DevonThink databases and all my PDF hyperlinks lead to DevonThink. As a result I regularly used the “Open in external viewer” function of DevonThink. Unfortunately the PDF is opened in the first page so you have to manually go to the desired page. If you need to do this a lot of times after a while it becomes annoying. So I wrote an AppleScript which automates this procedure :-) .The AppleScript is the following:

  • Open a DevonThink hyperlink directly to Skim March 6, 2011
    I use a QuicKeys macro in order to open a DevonThink PDF hyperlink directly to the specific PDF page in Skim. In the following image you see the required steps of the macro. In the third step you should put the whole AppleScipt from my previous post:  “Go from the current PDF page in DevonThink to the same page in Skim – AppleScript”

    Then you can assign a specific gesture (for example “four finger click”) using BetterTouchToul to the used hot key (option + cmd + F1) for the macro and you are done! Now you can bypass DevonThink and read the linked PDF page in Skim immediately!

    You can download this macro from here (right click + Sava as)

    Automation rules!

  • Automated creation of a LaTeX compatible citation only from Skim! (with hyperlink included) March 7, 2011
    In the post “How to put DEVONthink links in Skim notes“ I presented how you can create to a PDF file a number of Skim notes with various versions of references to itself. An example of these notes is shown below:

    Then you can insert manually the BibTeX cite command in the fist and the second note.

    Now you are ready to capitalize on these four little notes!

    The first way was presented in the post “Automated summary creation linked with the source pfd file” where the respective AppleScript use the fourth note:

     set pdfDevonThinkLink to (get text for note 4 of page 1 of document 1) as string

    In the AppleScript of this post the second note will be used.

    As you understand the numbering of these notes plays a fundamental role in the effective use of these AppleScripts. For this reason it is required that you create these notes when there are no annotations in the first page of the PDF file. Otherwise these four notes will take another index number and you will need to adjust accordingly the AppleScript (2011-04-05, an alternative solution is to use the AppleScript in my post “How to create correctly the Skim notes which have the DEVONthink links, when you have already annotated the first page of the PDF document“).

    One of the most important reasons for which I have chosen to write my essays using LaTeX is that it makes possible the creation of rich hypertexts. By rich I mean that the final PDF document can have all the sorts of different kinds of links as you can see in the lower part of my mind map “The many faces of links”. In order to create these links you should use the Hyperref package.

    If you are accustomed to the LaTeX markup code you will recognize that the second note includes a proper citation as it is required by the Hyperref package:

    (\cite{Deconstructing-the-Laws-of-Logic-Clark-2008a}: \href{x-devonthink-item://CDEC17B7-1EEE-42E1-B8C9-86A24C172BF3?page=}{})

    The only things that are missing from the above citation are two numbers: the number for the DevonThink link and the the number of the referred page.

    Now lets say that you would like to refer to the 27th page of the paper which is the third page of the PDF file. From now on you do not have to manually paste the necessary code and the appropriate numbers in your txt file but an AppleScript can do it for you!

    There is only one but… you want the number that is shown in your text to be 27 but the number which is attached to the DevonThink link to be 2 (3-1: if you do not know why, read my post It’s all about hyperlinks!). My AppleScript has the ability to recognize in which page you currently are but it cannot recognize the written number in the page! So you will have to enter it manually.

    The AppleScript code is the following:

    If you do not want to write even this number you can create a fifth note which will have only the written number of the first page and then the AppleScript can compute the rest.

    Finally the easiest case is when the page numbers of the PDF file and the printed book coincide. In this case you can still use the above AppleScript if you write in the fifth note the number 1. If you do not want to use a fifth note the AppleScript is the following:

    Before you execute any of the above AppleScripts you should have a TextMate document opened. Moreover the cursor should be at the point in which you want the citation to be inserted.

    2011-04-05
    There is an improved version of the above AppleScript in my post “Automated creation of references with hyperlinks from Skim

     

  • How to connect a PDF file inside DevonThink with its record in BibDesk March 8, 2011
    I use BibDesk  to manage and create my bibliographies but all my read and annotated PDF files are inside DevonThink. So I wanted an easy and fast way to connect the PDF files with their respective records in BibDesk. Technically I wanted to populate the “local URL” and “local File” columns of BibDesk. Consequently I wrote an AppleScript which does this job. :-) Moreover this AppleScript assigns the tag/keyword “Linked with DevonThink” to the record in which is applied. In order for this script to work properly you just have to select one PDF file in DevonThink and its respective bibliography record in BibDesk.The AppleScript code is the following:

  • How to convert a Mac-Unix style path to a Windows style path from Skim March 9, 2011
    Sometimes, I want to open a PDF file in my Windows virtual machine. To make things faster I wrote an AppleScript which converts the PDF file path of the front Skim window to its proper Windows style and then the converted path is sent to the clipboard.
    As a result, all I have to do after the conversion is to paste the new path to the “File” field of the “Open” window in Adobe Acrobat Pro in Windows.In order for this AppleScript to work properly, you need to customize the variable “WinPath” with the name and the drive letter of your hard drive.The AppleScript code is the following:

  • How to automatically embed hyperlinks into citations and bibliographical entries of a downloaded PDF document! Part I March 11, 2011
    Nowadays, it is possible for a researcher to amass a huge number of electronic papers and books about his specialized area of interest. Naturally there are a lot of cross-references between these sources. The usual way of managing these files is the creation of a bibliographical database in one of the numerous relative programs like EndNote, Papers, JabRef and BibDesk. In this post I will try to present an exciting new way of “managing” your files which in a way makes managing them obsolete!Specifically I created a workflow for embedding DevonThink hyperlinks into the very citations and bibliography entries of a PDF file. As a result when you want to read a cited paper or book you do not need to go to your bibliography manager program or even worse to the folder hierarchy of your hard drive in order to find the file. Instead you can just click the citation or the title or the author of the bibliography entry and the respective PDF file opens instantly! The magic of DevonThink hyperlinks in action!

    The required tools/programs for this dream to come true are the following:

    1. Adobe Acrobat Pro for Windows
    2. AutoBookmark plug-in for Adobe Acrobat Pro
    3. A Windows virtual machine
    4. DevonThink
    5. BibDesk
    6. TextMate
    7. Link dictionaries
    8. The AppleScripts for creating automatically the link dictionaries from BibDesk

    More details about the workflow

    AutoBookmark searches page text for occurrences of specific words or phrases and generates links annotations according to the user specifications. Link dictionary is a collection of search terms (words, phrases and etc.) and corresponding link actions. When it finds a search term from a dictionary it automatically creates a link annotation using a link action that is associated with it. Each search term should be unique within a link dictionary (excerpt from AutoBookmark help file). So you need to have an appropriate link dictionary so as the hyperlinks to the sources to be created automatically by AutoBookmark.

    For our case I consider optimal the use of two different dictionaries each with its own advantages and disadvantages. The first contains  various possible forms of author-year citations e.g. Clark 2008, Clark (2008, Clark Stephen (2008, Clark S. 2008, Clark S. (2008. The advantage of this dictionary is that the matches are almost 100% unique. However the probability of the match is somewhat small because of the high variability in the way that the citations are made. The second contains the source titles. Now the situation is the complete opposite because you can very easily have false positive matches if the title is too generic but there is no case of a missing match if the title is adequately complex.

    In my next post I will describe how you can create the link dictionaries from your Mac.

  • How to automatically embed hyperlinks into citations and bibliographical entries of a downloaded PDF document! Part II March 11, 2011
    How to create the dictionaries
    Firstly your ebooks and papers should be inside inside a DevonThink database. Moreover each source should have its respective record in BibDesk. The “local URL” field of each record should have the DevonThink URL of the source. If you do not know how to do this you can read my post “How to connect a PDF file inside DevonThink with its record in BibDesk“. Finally you should select the records in BibDesk which will constitute the records of the dictionary and you should have one TextMate txt file open. Now you are ready to execute either the AppleScript for the creation of the link dictionary with the titles or for the second kind of dictionary.The AppleScript code for the link dictionary with the titles is the following:

    A sample from the text which can be created is shown below:

    The AppleScript code for the link dictionary with author-year compinations is the following:

    A sample from the text which can be created is shown below:

    The AppleScript code for the link dictionary with author-year compinations is the following:

    A sample from the text which can be created is shown below:

    Now you are ready to go to Adobe Acrobat Pro and use the AutoBookmark plug-in. In the following screen shots you can see the detailed steps in order to create the new dictionaries.

    In this step you should select the txt file which was created by one of the two AppleScripts

    Now your link dictionary is ready.

  • How to automatically embed hyperlinks into citations and bibliographical entries of a downloaded PDF document! Part III March 17, 2011
    In the last post of this series I present how the embedding of hyperlinks is made in a sample PDF file. A prerequisite for the following actions it to have already created one or more link dictionaries (if you do not know how, read part II for detailed instructions and part I for more general related information).Let’s say that you have the PDF file opened in Skim. Then you should open it in Adobe Acrobat Pro in your Windows virtual machine. To make things faster you can have the Windows formatted path of this file in your clipboard by executing the AppleScript which I wrote in my post: “How to convert a Mac-Unix style path to a Windows style path from Skim”.

    In the following sreenshots you can see the required steps:

  • How to easily assign shortkeys and gestures to AppleScripts March 17, 2011
    In my daily workflow I use a significant number of AppleScripts, as you will have understoond from my previous posts :-) . So it is handy for me to assign shortkeys to some of them. For this purpose I use the FastScripts utility.  Although it is not a commercial app, it gives you for free up to 10 keyboard shortcuts.
     
    After the previous assignments you are able to trigger the execution of AppleScripts using customized gesture definitions with the help of BetterTouchTool app.

    In the following screenshot you can see some of my Skim gestures:

  • The roadmap of my blog on-line in MindMeister March 17, 2011
    Yesterday, I found a new on-line mind mapping tool, named MindMeister and I uploaded there the mind map about the various kinds of links that I use in my workflow. Moreover it is now embedded in the original post “A road map for my blog – The many faces of links” and you can navigate it also from here. I think it deserves a second post in this, greatly improved and interactive form!

  • How to reveal the front Skim PDF document in Finder and in DEVONthink March 24, 2011
    You can use the following AppleScript to reveal the front Skim PDF document in Finder:

    You can use the following AppleScript to reveal the front Skim PDF document in DEVONthink:

    In order for the last AppleScript to work properly, you need to have the DEVONthink URL in the fourth Skim note of the first page of the PDF in the following form:

    x-devonthink-item://648847AF-4714-4328-916C-6169A6389124?page=0

    In my post “How to put DevonThink links in Skim note” I describe how this can be done automatically.

    Moreover you need to adjust appropriately the name of the DEVONthink database  in the line:

        tell database “MySources”

  • How to create correctly the Skim notes which have the DEVONthink links, when you have already annotated the first page of the PDF document March 25, 2011
    In my post “How to put DevonThink links in Skim notes” I described how you can create to a PDF file a number of Skim notes with various versions of references to itself. These notes are created in the first page of the document and an example of them is shown below:

    In my post “Automated creation of a LaTeX compatible citation only from Skim! (with hyperlink included)” I write that “it is required that you create these notes when there are no annotations in the first page of the PDF file. Otherwise these four notes will take another index number and you will need to adjust accordingly the AppleScript”.

    Now it is time to overcome this limitation!

    Specifically, I wrote an AppleScript which temporarily removes all your annotations from your PDF file, then creates the desirable notes with the correct index numbers and at the end reinserts your annotations. You should run this script when you have selected one or more PDF files from a DEVONthink database.

    The AppleScript code is the following:

     

    2011-04-02
    Moreover, this AppleScript creates a fifth Skim note in the first PDF page with the default value zero. For more information about this note see my post “Latin page numbers, Arabic page numbers and the fifth Skim note“.

  • Latin page numbers, Arabic page numbers and the fifth Skim note April 1, 2011
    I have observed that my ebooks and papers which are in PDF format can be separated in one of the following three groups according to the relation between the page numbers that are given by Skim and the correspoding written numbers in the potentially printed PDF pages.

    The first group contains the PDF files in which these two numbers coincide for any given page.  In this case there is just the number zero in the fifth note in the first PDF page. This is the simplest case and an example of such a document is shown in the following image.

    The second group contains ebooks in which Latin numbers are used in a number of pages such as in its table of contents. In this case I put in the fifth note the negative total number of pages that precede the first PDF page with the written Arabic number 1. For example lets say that an ebook has its cover in the first PDF page, followed by six pages with Latin numbers. As a result the first PDF page with the Arabic number 1 is the eighth PDF page and the number -7 is written in the fifth note. In the following image you can see a page from the aforementioned ebook.

    By the way I do not find any value in the use of Latin numbers in electronic documents. To the contrary it makes the navigation of PDF files more difficult and cumbersome. One way to solve this problem is to move all the pages with Latin numbers and the cover at the end of the file. However, if you create these notes in your PDF files there is an alternative way of overcoming the problems which are caused by this relic of publishing tradition.

    Finally the third group contains papers from academic journals in which the written page numbers are totally out of sync with the page numbers which are given by Skim. In this case I put in the fifth note the written number in the first PDF page decreased by one. An example of such a document is shown in the following image.

    If there is an extra page with journal and paper information at the start of the document then you should substract by two.

    In my next posts I will present what can be achieved with the help of the fifth note.

  • Go to the written page number of a PDF document April 2, 2011
    In my previous post “Latin page numbers, Arabic page numbers and the fifth Skim note” I described the logic behind the number in the fifth note. Now we can use this information in order to go to the written page number of a PDF document without doing any calculations. This proves quite convenient especially in the case of academic papers in which the written numbers are totally out of sync with the page numbers which are given by Skim.The AppleScript which performs this function is the following:

  • Automated creation of references with hyperlinks from Skim April 5, 2011
    In the post “Automated creation of a LaTeX compatible citation only from Skim! (with hyperlink included)” there is an AppleScript which creates a LaTeX reference in TextMate for the PDF file that you currently read in Skim. Now I will present an expanded and improved version of that AppleScript. Specifically the new AppleScript takes advantage of all my standardized notes in the first page of a PDF document.These notes can be created automatically from the AppleScript in the post “How to create correctly the Skim notes which have the DEVONthink links, when you have already annotated the first page of the PDF document“. Moreover you can find more information about these notes in my posts “How to put DevonThink links in Skim notes” and “Latin page numbers, Arabic page numbers and the fifth Skim note“.The references and hyperlinks that can be created from my new AppleScript are the following and correspond to the notes one through four:

    1. A LaTeX reference to the exact PDF page which can be inserted in a MediaWiki page without any modifications or problems. Moreover, the necessary code for the creation of MediaWiki link is also included. An example is the following:

     (\cite{Deconstructing-the-Laws-of-Logic-Clark-2008a}: [x-devonthink-item://CDEC17B7-1EEE-42E1-B8C9-86A24C172BF3?page=2 27])

    A prerequisite for the use of this reference is to have installed and properly customized the Wiki2LaTeX MediaWiki extension. I will write more about this and its importance in a future post.

    2. A LaTeX reference that can be inserted in a text file together with the proper LaTeX code for the creation of the corresponding hyperlink. An example is the following:

    (\cite{Deconstructing-the-Laws-of-Logic-Clark-2008a}: \href{x-devonthink-item://CDEC17B7-1EEE-42E1-B8C9-86A24C172BF3?page=2}{27})

    3. A MediaWIki internal link to the wiki page of the source, followed by an external link to the PDF file itself. An example is the following:

    ([[Deconstructing the Laws of Logic - Clark]]: [x-devonthink-item://CDEC17B7-1EEE-42E1-B8C9-86A24C172BF3?page=2 27])

    4. A DEVONthink url

    How to use this AppleScript
    You should run the AppleScript when you read a PDF file in Skim and you want to make a reference to the current page. Additionally, a TextMate file should be opened. After the execution you can select from a menu which kind of reference you would like to be created. All the necessary numbers for the hyperlinks and the references are automatically created with the help of the fifth note. You can see this AppleScript in action in the following video:

    The AppleScript code is the following:

     

  • How to create hypermedia notes during your lectures! April 9, 2011
    There are some apps, which combine the features of a note taking and a voice recording app but in a very distinctive way. Specifically, they have the ability to continuously synchronize the recorded audio with your notes. As a result, each word acts as a link to the time point of the recorded audio at which it was written! Obviously this makes navigating a long lecture fast and easy and after a while you will start to appreciate the power of another kind of link!

    Currently, I use “AudioNote” for taking my hypermedia notes mainly because there is a version of it both for iOS and Mac OS X. Consequently, I can read my notes and hear the synced audio in all my platforms. An other app with a somewhat more polished interface and richer organizational abilities is “Notability” but you can you use it only in your iPhone or your iPad.

  • Count the words of a PDF file from Skim April 22, 2011
    Here is a small AppleScript for counting the words of a PDF file from Skim.

    Open source code in AppleScript Editor
  • Delete the duplicate Skim notes May 1, 2011

    With the following AppleScript you can delete the Skim notes which have exactly the same text in each page of a PDF file.

  • Recreate the folder and file hierarchy in text form compatible with MediaWiki syntax May 17, 2011
    Let’s say we have the following folder and file structure and we would like to pass it as text in a MediaWiki page.

    With the AppleScript of this post you can create automatically the necessary text, which is for our example the following:

    ===DevonThink scripts===
    Number of files: 0

    /MBSystem/Users/MB/Downloads/DevonThink scripts/

    ====Camino====
    Number of files: 3

    /MBSystem/Users/MB/Downloads/DevonThink scripts/Camino/

    Add PDF document to DEVONthink.scpt

    Add link to DEVONthink.scpt<br/>
    Add web document to DEVONthink.scpt<br/>

    ====DEVONagent====
    Number of files: 11

    /MBSystem/Users/MB/Downloads/DevonThink scripts/DEVONagent/

    Add PDF document to DEVONthink.scpt<br/>
    Add abstracts to DEVONthink Pro.scpt<br/>
    Add linked images to DEVONthink’s downloads.scpt

    Add linked images to DEVONthink.scpt<br/>
    Add links to DEVONthink’s downloads.scpt

    Add links to DEVONthink.scpt<br/>
    Add page to DEVONthink.scpt<br/>
    Add selection to DEVONthink.scpt

    Add tabs to DEVONthink.scpt<br/>
    Add text to DEVONthink.scpt<br/>
    Add web document to DEVONthink.scpt<br/>

    ====Firefox====
    Number of files: 3

    /MBSystem/Users/MB/Downloads/DevonThink scripts/Firefox/

    Add PDF document to DEVONthink.scpt<br/>
    Add link to DEVONthink.scpt<br/>
    Add web document to DEVONthink.scpt<br/>

    ====endo====
    Number of files: 1

    /MBSystem/Users/MB/Downloads/DevonThink scripts/endo/

    Add news to DEVONthink.scpt<br/>

    As you can see the folder hierarchy is recreated as a hierarchy of MediaWiki sections. Also the number of files in each folder and its path are added under the name of the corresponding section. If you choose to apply this AppleScript in a folder structure with thousands of files there will no be any problem but it will take a long time to finish.  The result is sent to the clipboard.

    The AppleScript code is the following:

    2011-05-20 I updated the code which creates the POSIX paths of the folders.

     

  • Sync PDF page numbers between Skim's snapshot window and main window. May 20, 2011
    A quite useful feature of Skim is that “you can take “snapshots” of important sections (like the bibliography section) of a PDF document, to keep them on your screen for easy reference. This way you don’t have to leaf back to the section every time you want to see it” (Skim help file).But the snapshot windows are just for viewing the material. For example, you cannot highlight or select text in them. In order to make annotating of these pages easier I wrote an AppleScript, which instantly shows you in the main window, the current page in the snapshot window. When you finish annotating this page you can go back to the previous page by using the cmd + [ shortkey or by triggering the corresponding gesture (I use the "three finger left" gesture for this task).If you use more than one snapshot windows from the same document, after selecting the page that you want to annotate in one of them, you need to click one time all the remaining snapshots windows, before running the AppleScript.

    The AppleScript code is the following:

  • Embed AppleScripts in a MediaWiki page May 29, 2011
    You can embed an AppleScript in a MediaWiki page if you insert the script as the URL in a proper HTML link. Particularly, the HTML link syntax looks like this:
    <a href=”URL”>Link text</a>

    The AppleScript code should be converted in a format which is compatible with HTML URLs. For example, each space in the script should be replaced by the string %20, each tab by %09 and each enter by %0D. Moreover, the “applescript://” URL scheme will be used and the whole link should be within <html>, </html> tags.   Fortunately the whole conversion can be done automatically by an AppleScript or using the freeware AppleScriptHTML app.

    Finally, raw HTML code is not allowed by default in a public wiki for security reasons but if you maintain a private wiki you can permit it by setting

    $wgRawHtml = true;

    in the LocalSettings.php file.

    For example, suppose you want to embed the following AppleScript

    tell application “Finder”
        open (alias “MBSystem:Users:MB:Downloads:”)
    end tell

    which opens the “Downloads” folder in a Finder window. Then, you should write the following code in a MediaWiki page:

    <html>
    <a href=”applescript://com.apple.scripteditor?action=new&script= tell%20application%20%22Finder%22%0D
    %09open%20(alias%20%22MBSystem%3AUsers%3AMB%3ADownloads%3A%22)%0D
    end%20tell”l>MBSystem:Users:MB:Downloads:</a>
    </html>

    and you will see the link, after saving the page.


    Afterwards, every time you click the link an AppleScript editor window opens with the AppleScript code inside it, as is shown in the next image.

    Now, you may press cmd + R (executes the script), cmd + W (closes the window) and cmd + D (without saving)!

    In my next post, I will present how you can create automatically HTML links to local files and folders, with AppleScript code inside them, which can be embedded in a MediaWiki page.

  • Create MediaWiki links to local folders and files without any extension! May 31, 2011
    In my previous post “Embed AppleScripts in a MediaWiki page“, I showed how an AppleScript, embedded in a HTML link, can be inserted in a MediaWiki page. A way that I use this MediaWiki feature is by creating links to local files and folders. Moreover, after executing the AppleScript, the files open with their assigned applications. Finally as you can see in the same post, the whole link syntax is quite complicated so I wrote an AppleScript, which creates automatically all the required code for the selected files and folders in Finder. The names of them should be in Latin characters.The AppleScript code is the following:

  • Add keywords to many entries of BibDesk at the same time June 1, 2011
    The following AppleScript performs the above function:

  • Add tags to many DEVONthink items at the same time June 5, 2011
    In DEVONthink, when two or more items have exactly the same tags, new tags can be added to them using the tag bar at the lower part of a DEVONthink window. But when their tags are different the message “Multiple Selection” appears in the bar and you cannot edit it. With the following AppleScript you can add multiple tags even to these items.
     

  • Export Skim notes according to their highlight colors June 10, 2011
    Adam Cronkright mentioned, in a thread in the Skim forum, that he uses different colors for highlighting various sections of a PDF, which have a common characteristic (e.g. author’s points he agrees with, points he disagrees with, good phrases…). His problem is that he would like to have an efficient way to organize these different categories of notes and Skim’s present features does not help him much to this end.I think that a way to solve this problem is to use a specialized app for note management and an AppleScript, which exports Skim notes according to their color. So I found a reason to write an additional AppleScript or actually two!The first is a simplified version, which has only one prerequisite for execution. Particularly, you need to use one or more of the following colors: ice, honey drew, flora, lemon, cantaloupe, silver, which are shown below.

    You can change a color in the Favorite Colors by dragging a new color from the Color Panel (Tools> Show Colors) and drop it on the Favorite Colors toolbar item. Hold down the Option key to add a new color. You can remove a color from the Favorite Colors by dragging it to the Trash (from Tips and Tricks page in Skim’s wiki).

    Each color in Skim is represented as a list of four numbers (red, green, blue, alpha). The fourth number is constant (65535). For example, the ice color is represented by the list  {26214, 65535, 65535, 65535}. So you can change the hardwired colors in the scripts if you know the corresponding RGB (red, green, blue) code in 16-bit format for your preferred colors. Then you can add it in in the chooseColor subroutine (see the AppleScript below).

    When you execute the script the following windows will open consecutively:

    You can choose more than one colors by pressing cmd + click.

    If you choose “Some” then you will be asked to give the range of pages from which the notes will be extracted.

     

    The result is sent to the clipboard.

    The second AppleScript is that which I use and is quite more complicated. As you may know, my preferred program for managing notes is MediaWiki so the AppleScript’s result is customized for import in a MediaWiki page.

    Some additional features of this AppleScript are the following:

    • a hyperlink to the exact PDF page is created for each exported note
    • the annotation’s date and time are added at the end of each exported note
    • the notes from each page are separated by a line
    • the extended text of the note is exported as well
    • the first five notes of the first page are not exported
    • the written page numbers should be given in the dialog windows

    If you want to use this AppleScript you need firstly to create the five Skim notes in the first PDF page as I describe in my post “How to create correctly the Skim notes which have the DEVONthink links, when you have already annotated the first page of the PDF document.

    The code is the following:

    I hope this AppleScript will help Adam! Anyway, your post was an inspiration for me. Finally, I would like to thank Martin who informed me about it.

  • Convert DEVONthink tags to MediaWiki categories June 18, 2011
    DEVONthink has a quite efficient tagging capability. Especially, the autocomplete feature of the tag bar, at the lower part of a DEVONthink window, saves me a lot of time and provides increased consistency in my tags.Moreover, I maintain a separate page in my wiki for each book or paper that I have read. There I write all my notes and thoughts about each source. MediaWiki’s name for tag is category and the required markup code for it is the following:

    [[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:

  • Send DEVONthink tags to BibDesk as keywords June 24, 2011
    Continuing in the same spirit as in the previous post, I wrote an AppleScript for sending DEVONthink tags to BibDesk. Only one item should be selected in DEVONthink and BibDesk. No duplicate keywords are created in BibDesk.The AppleScript code is the following:
  • MediaWiki, Mac and custom URL schemes December 1, 2011

    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.

  • Convert HTML links to RTF links December 3, 2011

    Let’s say that you have a HTML link (e.g. <a href=”x-devonthink-item://C7D4CA83-F668-4CF3-929D-5DA09572337F?page=3″>Thesis: 4</a>) in your clipboard and you would like to use it in a RTF document. Of course If you just paste it you will not get a working link in your RTF document. It needs to be converted to the RTF format. The following AppleScript sends the converted link to the clipboard and then you are free to use it for example in a Pages or or a Nisus Writer document.

  • Create MediaWiki and RTF links for opening an ePub file with Calibre viewer December 3, 2011

    I have all my ePub files inside a Calibre database and I use its very nice Ebook Viewer for reading them. Unfortunately Ebook Viewer is not a seperate application and you need to open first the Calibre database, then find the file and at last you can open it with the viewer by pressing the V key. But there is a faster way to open it by using the following command in Terminal:

    do script “ebook-viewer –raise-window \”/Users/MB/Downloads/Object-Oriented Programming with Objective-C.epub\”"

    An extra advantage of this method is that the ePub file is not required to be inside a Calibre database! You can have your files wherever you want.

    Of course, it is quite difficult to write the above command every time you want to read a book. But AppleScript can carry all that burden for us! Specifically I wrote an AppleScript which creates automatically the above command for a selected file in the Finder and wraps it up inside a MediaWiki link or a RTF link. Then you can just paste the link in a wiki page or a RTF document. Afterwards, every time you click the link an AppleScript editor window opens with the required AppleScript code inside it. Finally, you may press cmd + R (executes the script), cmd + W (closes the window) and cmd + D (without saving)!

    The AppleScript code for creating MediaWiki links is the following:

    The AppleScript code for creating RTF links is the following:

  • Create MediaWiki and RTF links for opening an ePub file at a specific position with Calibre viewer December 17, 2011

    Ebooks, unlike paper books, have no concept of pages. Instead, as you read through the book in Calibre’s Ebook Viewer, you will notice that your position in the book is displayed in the upper left corner in a box like this navposi. This is both your current position and the total length of the book. These numbers are independent of the screen size and font size you are viewing the book at, and they play a similar role to page numbers in paper books. You can enter any number you like to go to the corresponding location in the book (from Calibre’s manual).

    On 02/12/2011 I asked for the addition of a book position argument in the ebook-viewer commad from Calibre’s developer Kovid Goyal. On 09/12 the 0.8.30 version of Calibre was released with the above enhancement incorporated in it! Thanks Kovid! As a result, now we are able to create links to a specific point of an ePub file which is very handy for reference reasons.

    I modified the AppleScripts of the previous post and now when you execute them, a window will pop up and you will be asked for the specific book position. Afterwards, the necessary code will be sent to the clipboard. Finally, you should have selected the ePub file, for which you want to create the link, in Finder before executing the script.

    The AppleScript code for creating MediaWiki links is the following:

    The AppleScript code for creating RTF links is the following:

     

     

  • Execute an AppleScript with an AppleScript! December 18, 2011

    As you may know from my previous posts (see for example here), I use the AppleScript URL scheme in order to create various links. When you click on one of these links a new AppleScript Editor window opens (normally named “Untitled”) and then you would like to run it, most of the times, as fast as it is possible. One way is to press cmd + R (executes the script), cmd + W (closes the window) and cmd + D (without saving). A faster way is to perform the above actions with the help of an AppleScript and then assign to it a custom shorkey (e.g. shift + ctrl + option + A) and a gesture (e.g. five finger touch/move).

    The AppleScript code is the following:

    In order for the script to work properly, no other AppleScript Editor windows named “Untitled”, “Untitled 2″ etc should be open before clicking the link.

  • Create MediaWiki and RTF links to audio and video files of your iTunes library December 19, 2011

    I use iTunes in order to organize and play my media files. I have written the following AppleScripts in order to have the ability to create direct links to these files. These links are quite persistent because they are not depended on the path of each file.

    You should have selected one or more media files in your iTunes library before executing the scripts. The code for the links is sent to the clipboard and you may paste it to a MediaWiki page or a RTF document. Afterwards, every time you click a link an AppleScript editor window opens with the required AppleScript code inside it. Finally, you may press cmd + R (executes the script), cmd + W (closes the window) and cmd + D (without saving) or have the same effect by executing the AppleScript of this post.

    The AppleScript code for creating MediaWiki links is the following:

    The AppleScript code for creating RTF links is the following:

  • Create MediaWiki and RTF links to specific time points of audio and video files of your iTunes library December 20, 2011

    Nowadays you can find from iTunes university and other sources a vast number of recorded lectures from the best universities of the world. Sometimes it would be helpful to have the ability to refer to specific points of them as you can do when you read a PDF file and you use DEVONthink. From now on there is an AppleScript for that!

    I wrote two versions of this AppleScipt with a slightly different functionality. The first creates a link to a custom time point, which you set manually after executing it. One or more files should be selected in your iTunes library before executing it.

    The AppleScript code for creating MediaWiki links is the following:

    The AppleScript code for creating RTF links is the following:

     

    The second version creates a link to the current track that plays in iTunes to the current time point.

    The AppleScript code for creating MediaWiki links is the following:

    The AppleScript code for creating RTF links is the following:

    Again the code for the links is sent to the clipboard and you may paste it to a MediaWiki page or a RTF document. Afterwards, every time you click a link an AppleScript editor window opens with the required AppleScript code inside it. Finally, you may press cmd + R (executes the script), cmd + W (closes the window) and cmd + D (without saving) or have the same effect by executing the AppleScript of this post.

     

  • Create MediaWiki and RTF links to iPhoto pictures December 23, 2011

    I use iPhoto for organizing my pictures. I have written the following AppleScripts in order to have the ability to create direct links to them.

    You should have selected one or more pictures in your iPhoto library before executing the script. The code for the links is sent to the clipboard and you may paste it to a MediaWiki page or a RTF document. Afterwards, every time you click a link, an AppleScript editor window opens with the required AppleScript code inside it. Finally, you may press cmd + R (executes the script), cmd + W (closes the window) and cmd + D (without saving) or have the same effect by executing the AppleScript of this post.

    The AppleScript code for creating MediaWiki links is the following:

    The AppleScript code for creating RTF links is the following:

  • Create MediaWiki and RTF links to Evernote notes January 26, 2012

    The ability to create RTF links to specific Evernote notes is already built in Evernote app. You can just select the preferred notes and then click Copy Notes Links either from the menu Note

    or from the contextual menu (control + click or tap with two fingers to brought is up)

    Then you can paste the links in any RTF document.

    If you would like to create MediaWiki links you can use the following AppleScript:

    The result is sent to the clipboard.

    Finally, in order for the links to be recognized by MediaWiki, you should add the following line of code

    $wgUrlProtocols[] = “evernote://”;

    to the Localsettings.php file. Its path in my computer is /Applications/MAMP/htdocs/WikiName/LocalSettings.php.

     

     

  • Convert words in MediaWiki page titles to MediaWiki categories March 16, 2012

    Most of the times I find that is quite reasonable to have the words that are in the title of a MediaWiki page as categories of it. So I decided to automate the whole procedure :-) using the following AppleScript:

    The above AppleScript is for Firefox because I browse and edit my wikis mainly using Firefox. Unfortunately Firefox’s support for AppleScript is minimal. So if you would like to use this AppleScript, you need to change a little its source code. Specifically, you need to set the value of the property firstTwoLettersOfMyWikiName. Finally in the variable wordsNotForCategories I specify some words that I do not want to be converted to categories.

    You should be in the edit mode of a MediaWiki page before executing the script. Moreover, the cursor should be at the point that you would like the categories to be inserted because the result of the AppleScript is pasted automatically.

    If you use Safari you can achieve the same results using the following AppleScript:


    You do not need to make any modifications to this script.

  • Count the number of pages of selected PDF files in your DEVONthink database March 25, 2012

    I wrote the following AppleScript in order to satisfy my curiosity about this number!

  • Find and replace strings in the names of selected files and folders in Finder April 5, 2012

    An AppleScript which does this job is the following:

  • Create iTunes links with TunesLinker April 18, 2012

    As you may know, with DEVONthink you can create  links to specific pages of a PDF file. Now with TunesLinker, you can easily create links to specific time points of your iTunes media. I wrote this application because I could not find similar functionality to any other Mac application. You can buy TunesLinker from App Store for $1.99. You can read more information about TunesLinker here or download its help file in PDF format from here.





  • Create link to a specific PDF page for ConnectedText using an AutoHotkey script May 2, 2012

    Some of my friends use ConnectedText for organizing their notes and I find it one of the best note-taking application for Windows. Generally speaking, ConnectedText is a more user-friendly “version” of MediaWiki as they have a lot of common characteristics but it is only for personal use.

    One problem with ConnectedText is that its syntax for creating a link to a specific PDF page is quite complex and the corresponding string can become very long. Fortunately, this process can be automated using an AutoHotkey_L script. AutoHotkey is a very powerful and free utility for automating Windows and AutoHotkey_L is a custom build of it.

    An example of such a link is the following:

    [[$APP: acrobat.exe /a "page=3" "C:\MyPdf.pdf" | MyPdf: 3]]


    A button is created with this code and after clicking on it the Adobe Acrobat Pro will launch and the MyPdf file will open at its third page. If you use Acrobat Reader the syntax is:

    [[$APP: acrobat.exe /a "page=3" "C:\MyPdf.pdf" | MyPdf: 3]]

    Before running the script you should have selected in Windows Explorer the PDF file for which you would like to create a link. The shortcut that triggers its execution is ctr + alt + l (small capital L). Afterwards you will be asked for the specific PDF page. At the end, the string is sent to the clipboard. The text in the button will be:

    MyPdf: 3

    The main disadvantage of these links is that they are depended on the absolute path of the PDF file. If for example you move later the file to another folder the link will break. On the contrary DEVONthink links do not have this limitation which is extremely important for me.

    The AutoHotkey code is the following:

  • Integrate Microsoft Word with DEVONthink May 16, 2012

    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:

    Click here to open the source code in AppleScript Editor

  • Create hyperlink to a specific PDF page in Microsoft Word for Windows May 19, 2012

    You can make a Word hyperlink to a PDF file in your local file system by inserting a URL like the following: “file:///C:\Grammar.pdf” in the “Address” field of the “Insert Hyperlink” window.

    Unfortunately, Microsoft Word does not recognize the usual argument “#page=” for denoting a specific PDF page. You can overcome this limitation by creating and using the following Word macro.

    The source for the function OpenPagePDF is from http://www.acrobatusers.com/forum/general-acrobat-topics/link-specific-page-pdf-word/

    You can install the above VBA code by following these steps:

    1. Select the Developer Tab in the Ribbon. If it is not shown please follow the instructions below.
      • Choose the Microsoft Office Button (in the left up corner).
      • Choose Word Options (in the right down corner).
      • In the categories pane, choose Popular.
      • Select the Show Developer tab in the Ribbon check box.
      • Choose the OK button to close the Options dialog box. (Source: http://msdn.microsoft.com/en-us/library/bb608625.aspx)
    2. Select “Macros” in the Developer Tab.
    3. Give the name “GoToPDFPage”.
    4. Click “Create” button
    5. and the “Microsoft Visual Basic” window will open
    6. You should write in this window the source code that is given above. At the end the window should look like the one below: Then you can save and close this window.
    7. Finally, you should see a macro named “GoToPDFPage in the “Macros” window.

    Now every time you want to activate a hyperlink to a specific PDF page you should have the cursor inside the link text and then you should execute the GoToPDFPage macro either by clicking the “Run” button in Macros window or by assigning a keyboard shortcut to this macro following the steps below:

    1. Click the Microsoft Office Button , and then click Word Options.
    2. Click Customize.
    3. Next to Keyboard shortcuts, click Customize.
    4. In the Categories list, click Macros.
    5. In the Macros list, click the macro that you want to be assigned a shortcut
    6. In the Press new shortcut key box, type the key combination that you want (e.g. Alt + l)
    7. .

    8. Check the “Currently assigned to” to make sure that you aren’t assigning a key combination that you already use to perform a different task.
    9. Click assign. Important: in order to make your macro available in all documents, be sure to click Normal.dotm. Source: How can I assign or change keyboard shortcuts to existing macros?)

    If you just click on the hyperlink, the PDF file will open in the first page and not in the page that you have specified after the “page=” string.

    Finally, with the following AutoHotkey script you can get the path of a selected PDF file in Windows explorer automatically. This script is executed using the Ctrl+Alt+C shortcut and the result is sent to the clipboard (e.g. “file:///C:\Grammar.pdf#page=”). Afterwards you should only add the specific PDF page at the end of the string.

    In summary the use case for creating the hyperlink is:

    1. In Word, select text and use Insert > Hyperlink or Ctrl+K
    2. Insert the PDF path to the “Address” field either manually or by selecting in Windows Explores the PDF file for which you would like to create a link and clicking Ctrl+Alt+C
    3. Insert the PDF page number

    In summary the use case for activating the hyperlink is:

    1. Put the cursor inside the text of the link
    2. Execute the macro by clicking “Run” in the Macros window or Alt+l.

     

  • Skim and color codes of highlights August 5, 2012

    In my post “Export Skim notes according to their highlight colors” I presented how you can export Skim notes of a specific color using an appropriate AppleScript. The proper functioning of the script is depended on the correct representation of the color that is used in the highlights. In Skim’s wiki you can read that “colors are represented according to the RGBA (Red-Green-Blue-Alpha) model as a list of four integers, each one ranging from 0 to 65535 (= 216 – 1). For example, {65535, 0, 0, 65535} represents the color red”.

    Some people have asked me how they can get these numbers for an arbitrary color. The solution to this problem can be given again by AppleScript and the following script:

    The outcome of this script is a window in which the color codes of the current PDF page in Skim are shown.

    A non programming solution to the same problem is given by the excellent app ScriptDebugger. Specifically, one of its most powerful tools is the “Explorer” with which you can see in real time all the objects of an AppleScriptable application together with their properties and values. In our case, you can see in the following screenshot the color code of the first note.

  • Create DEVONthink bookmark for the current PDF page August 6, 2012

    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.

  • Create universal indexes for your own books and papers September 30, 2012

    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:

    1. You can immediately see all the instances of the indexed word or phrase which are in each document.
    2. You can copy a part or the whole of it in one or more documents.
    3. 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.

  • About OrganoGnosi October 3, 2012

    Organo and gnosi are the transliterated forms of the Greek words “όργανο” and “γνώση”, respectively, which can be translated as tool and knowledge. This blog is about tools (e.g. computer applications, scripts) and methods (e.g. automated digital workflow, hypertext writing) that a researcher can use in order to be more efficient in his/her efforts for finding and inventing new knowledge. The single most important element of my workflow is the creation and use of links or hyperlinks. A necessary condition for knowledge is the connection of at least two concepts. Moreover, in each academic work there are multiple references to previous works. These connections can be externalized, organized and saved for further study using links. The text in which there are links is called hypertext. The easiest way for writing hypertext is the use of a wiki program. Wikis are promoted largely as collaboration tools but they can be used in a personal setting as well. Unfortunately, the seamless use of links is not supported by the majority of the computer applications. This is the main reason for finding in my blog so many posts about how to create a certain kind of link. The programming language that I have written most of my scripts is called AppleScript and can be used only in Macintosh computers. However, a Windows user can still implement the core of my workflow, which is the writing of hypertext.

  • Wikis in University Teaching and Learning - Richard Buckland October 17, 2012

  • How to copy the frontmost Skim PDF document to Dropbox and iCloud November 25, 2012

    For reading PDF files on my iPad I use most of the time the PDF Expert app combined with Dropbox. Moreover, I am experimenting with PDFpen apps for iOS and OS X which use iCloud in order to synchronize the PDF files and their annotations. Undoubtedly, the automatic and on the fly synchronization of my highlights and notes is quite impressive but I still consider Skim to be the best Mac application for reading PDF documents. As a result, I wanted an easy and fast way to send the PDF files, which I would like to read on my iPad, from Skim (more precisely from my DEVONthink databases) to my Dropbox and iCloud folders. This can happen with the following AppleScripts.

    The first script sends the frontmost Skim PDF document to my Dropbox folder (:Users:MB:Dropbox:0 PDF files:) and the second to the iCloud folder for PDFpen (:Users:MB:Library:Mobile Documents:7PKJ6G4DXL~com~smileonmymac~PDFpen:Documents:). You should customize the variables which store the above paths in order for the scripts to function in your computer.

    The Skim annotations are automatically embedded in the PDF document and you can see and edit them without any problem using either PDF Expert or PDFpen.

    
    

    Click here to open the source code in AppleScript Editor

    
    
    Click here to open the source code in AppleScript Editor
  • Control the brightness of your monitor with DarkAdapted November 26, 2012



    At night I find the minimum brightness level of my MacBook Pro too intense. In order to solve this problem, I use the DarkAdapted app.

    DardAdapted

    I have created the following custom presets:

    My custom settings

    Each preset corresponds to a different level of ambient darkness (dark, dart+, dark++, dark+++, dark++++ and brightness reduction (70%, 60%, 50%, 40%, 30%). The absolute color values for each level are shown below:

    Level Red   Green   Blue  
    Dark 70% 180 180 180
    Dark+ 60% 150 150 150
    Dark++ 50% 125 125 125
    Dark+++ 40% 100 100 100
    Dark++++ 30%     75 75 75

    Unfortunately, the developer has passed away and the official website is down. However, you can still download the app from here. The standard version of the DarkAdapted is free. At the moment you cannot buy the Pro version.


  • My favorite MediaWiki extensions November 27, 2012
    • DynamicPageList is the single most useful extension that I use. It creates mainly list of pages satisfying various criteria (e.g. category, notcategory, linksfrom, linksto, title, uses, usedby, namespace). For more information you can read its extensive manual.
    • Labeled Section Transclusion allows selective translusion of marked-off sections of text. When it is used in combination with DynamicPageList you can synthesize the existent wiki content and create new dynamic pages according to specific criteria.
    • MathJax provides an easily installed way for typesetting LaTeX formulae in MediaWiki pages.
    • Wiki2LaTeX converts Mediawiki syntax into LaTeX.
    • WolframCDF allows cdf files generated by Mathematica to be shown in MediaWiki pages.
    • BreadCrumbs shows a trail of visited pages during the user’s session.
    • QuickLink makes easier and faster the searching and insertion of internal links.
    • SyntaxHighlight_GeSHi displays formatted source code written in more than 120 programming languages.
    • ReplaceText provides a special page to allow administrators to do a global string find-and-replace on both the text and titles of the wiki’s content pages.
    • MultiBoilerplate allows a boilerplate to be selected from a drop down box located above the edit form when editing non-existent pages.
    • Semantic MediaWiki helps to search, organise, tag, browse, evaluate, and share the wiki’s content.
  • Presentation: Digital Tools for Academic Research March 5, 2013

    Digital Tools for Academic Research by

    Tomorrow I will have the honor to make a presentation at Saint Edmund’s college of the University of Cambridge.

    Presentation - St Edmunds

  • Send to clipboard the selected text in the browser, the source URL and the current date and time April 5, 2013

    Almost every day I find something interesting in a web site which I usually copy and paste it inside a wiki page. Moreover, I insert the URL of the web page and the current time and date. An example is the following:

    AppleScript’s “big advantage” over other scripting languages (which, frankly are much better to use for most tasks) is that it can automate the action of other applications on your Mac (as long as the developer has provided an AppleScript dictionary). (http://stackoverflow.com/questions/1317497/what-is-applescript-and-what-is-it-used-for/1317498#1317498 – [[2013-02-22]], 12:56)

    I enclose the date in double brackets because that way a link is created to the page with the title “2013-02-22″ in which I keep my journal for the specific day. An additional bonus created from the link to the specific date is that when I visit the wiki page of that date, I can see a list of all of the pages that have a link to that page. This list is a good indicator of the subjects that I dealt with that day! This list is created by the following DynamicPageList query: {{#dpl: linksto = 2013-02-22 }}

    

    Naturally, I wanted to automate the whole process so I created one bookmarklet for Firefox and one AppleScript for Google Chrome. The only difference between the two is that the AppleScript sends all the data automatically to clipboard while in Firefox the data will be shown in a separate window and then you need to press control + C and close the widow by pressing either Ok or Cancel.

    The AppleScript is the following:

    Click here to open the source code in AppleScript Editor

    The bookmarklet is the following: