Skip to content

Instantly share code, notes, and snippets.

@sarkrui
Last active December 16, 2022 09:27
Show Gist options
  • Save sarkrui/51769bbb702e0d0a5505203964d8c70b to your computer and use it in GitHub Desktop.
Save sarkrui/51769bbb702e0d0a5505203964d8c70b to your computer and use it in GitHub Desktop.
Automator Application to Export References as Bib file for Overleaf

Demo

Please use Better BibTeX for Zotero to generate the URLs of your literature collections.

AppleScript

on run {input, parameters}
	set p to path to me
	return p
end run

Passing result as arguments for the Shell Script

Shell Script

APP_PATH=$1
cd $1 && cd ../
rm -f config
cat list.txt | while read f; do echo -e "url = \"${f}\"\n-O\n" >> config; done;
curl -K config
#!/bin/bash
cd "$(dirname "$0")"
rm -f config
rm -f *.bib *.biblatex *.bibtex
sleep 10
echo "Waiting for Dropbox's synchronization..."
cat list.txt | while read f; do echo -e "url = \"${f}\"\n-O\n" >> config; done;
echo "Downloading bibtex from Better Biblatex..."
curl -K config
sleep 5
hasBiblatex=$(ls -1 *.biblatex 2>/dev/null | wc -l)
hasBibtex=$(ls -1 *.bibtex 2>/dev/null | wc -l)
if [ $hasBiblatex != 0 ]
then
for file in *.biblatex; do
name=$(basename "$file" .biblatex) # surround the filename with double quotes to account for file names with spaces
mv "$file" "$name.bib" # put echo in front when testing to see what the program would do without actually changing anything yet
done
fi
if [ $hasBibtex != 0 ]
then
for file in *.bibtex; do
name=$(basename "$file" .bibtex) # surround the filename with double quotes to account for file names with spaces
mv "$file" "$name.bib" # put echo in front when testing to see what the program would do without actually changing anything yet
done
fi
@sarkrui
Copy link
Author

sarkrui commented Dec 13, 2022

  • Convert file type from biblatex or bibtex to bib for Overleaf's compatibility: release-v1.1
  • Automator Application and plain list file: release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment