Export citation as bibtex file

This website allows a citation to be pasted and then exported as a bibtex file: https://anystyle.io/

For example, I can paste this citation and export as a bibtex file:

Merriam, C.H. 1884. Breeding of Passerculus princeps on Sable Island. Auk 1: 390-400

But wondering if I can do the parsing and export to bibtex file within Keyboard Maestro. Then I could simply copy the citation to clipboard and run a Keyboard Maestro macro to export as a bibtex file.

This code is provided by the website. Can I run this in Keyboard Maestro? If yes, how can I edit the code to always export as bibtex?

$ [sudo] gem install anystyle

>> require "anystyle"

>> AnyStyle.parse """
    Turing, Alan, Computing Machinery and Intelligence, Mind 59, pp 433-460 (1950)
   """
=> [{
     :type => "article-journal",
     :author => [{ :family => "Turing", :given => "Alan" }],
     :date => ["1950"],
     :title => ["Computing Machinery and Intelligence"],
     :"container-title" => ["Mind"],
     :volume => ["59"],
     :pages => ["433–460"],
     :language => "en",
     :scripts => ["Common", "Latin"]
   }]

It looks to me like the website will work with the KM Button action. However I'm starting to prepare for my vacation next week so I can't really spend a lot of time on this issue with you. You can either read up on the Button action or wait for someone else to offer a solution.

image

Can the code not be run within Keyboard Maestro?

Since the "Press Button" action is a KM action, I don't know what you mean by "Can it be run within Keyboard Maestro." All KM actions are run within KM.

Ohhh... I think I know what you mean now. You want KM to do all the work involved, instead of having KM send the data to the website and get the website to do all the work involved. I'm not sure what benefit that provides, but sure it should be possible.

Why don't you just rely on the website to do the work? The website lets you convert references to files for free, right? You can just use KM to send the reference to the website and get back the answer for free. If you want KM to do all the work, that's possible, but it could be a lot of work. And the website provides a choice of three formats as the output. I think you are saying you want the Bibtex format, but I know nothing about that format.

I think the code used by the website is publicly available on Github, but I'm not sure if anyone wants to port an entire project from Github to KM, especially when you already have the option of just using the website to upload and convert your data at no charge.

This is what I want to do: copy text (citation) to clipboard and hit a keyboard shortcut that saves a .bib file (containing parsed citation) to my computer.

Good. Here are your choices, as I see it:

  1. Write a KM macro to submit the data to the anystyle website and convert your files to Bibtex using that site, easy and free.
  2. Install the anystyle software on your Mac and then write a KM macro to submit your data to the program running on your Mac.
  3. Use KM to duplicate the functionality of anystyle.

Which method are you most interested in? I'm guessing "2". So, have you installed it on your Mac already?

Any further input on this? How do I run the code in opening post in Keyboard Maestro?