-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from Jmuccigr/master
Use with any application.
- Loading branch information
Showing
4 changed files
with
88 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,27 @@ | ||
# zotpick-applescript | ||
|
||
Leverage [Better-BibTeX's citation picker](https://zotplus.github.io/better-bibtex/cayw.html) in Scrivener | ||
Leverage [Better-BibTeX's citation picker](https://zotplus.github.io/better-bibtex/cayw.html) in your word-processing app. | ||
|
||
These three scripts allow you to use [Better BibTeX's citation picker](https://zotplus.github.io/better-bibtex/cayw.html) | ||
with Scrivener. The three applets (available compiled in the Releases section) correspond | ||
to the three available citation ouputs: pandoc formatted citations, MultiMarkdown | ||
formatted citations, and Scannable Cites | ||
with any word-processing app. The three applets (available compiled in the Releases section) correspond to the three available citation ouputs: pandoc-formatted citations, MultiMarkdown-formatted citations, and Scannable Cites | ||
(for [RTF/ODF Scan for Zotero](http://zotero-odf-scan.github.io/zotero-odf-scan/)). | ||
|
||
To use, set one of the applets as your refernce manager in Scrivener, call up with ⌘-Y | ||
and search for a citation in the box. Suffixes, prefixes, page numbers and author | ||
suppression can be set by clicking the selected citation in the search box and filling | ||
out the options. These do not work in MultiMarkdown output. | ||
## Basic usage | ||
|
||
These applets work well in conjunction with this workflow for using [Scrivner, Pandoc, Zotero and Marked 2 for academic writing](http://davepwsmith.github.io/academic-scrivener-howto/). | ||
When you run one of the scripts, Zotero (which must already be open and have Better BibTeX installed) will appear and open a search box where you can search for the desired citation. Suffixes, prefixes, page numbers and author suppression can be set by clicking the selected citation in the search box and filling out the options, but these do *not* work in MultiMarkdown output. The resultant citation text will then be entered into the app you were working in when you ran the script. Since the script is basically typing the citation into your application, it should work with any word processor (and any others that accept text input as well). | ||
|
||
**N.B** **These applets will type over whatever text you have selected when you call them. You have been warned.** | ||
Please report any errors as issues on the [GitHub page](https://github.com/davepwsmith/zotpick-applescript). | ||
|
||
--- | ||
|
||
## With Scrivener | ||
Set one of the applets as your reference manager in Scrivener, call up with ⌘-Y. | ||
|
||
These applets work well in conjunction with [this workflow](http://davepwsmith.github.io/academic-scrivener-howto/) for using Scrivener, Pandoc, Zotero and Marked 2 for academic writing. | ||
|
||
## With other Apps | ||
|
||
One or both of these approaches will work: | ||
|
||
- To use these scripts with any application is to put them in your ~/Library/Scripts folder. Or to use them with one specific app, put them inside a folder with that app's name inside the Scripts folder. | ||
- If you use an app-launching utility that lets you assign key combos to apps, use that to launch these scripts. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,38 @@ | ||
tell application "System Events" | ||
try | ||
set appName to (the name of every process whose frontmost is true) as string | ||
on error errMsg | ||
display alert "Problem" message "Could not get the name of the frontmost application." | ||
error number -128 | ||
end try | ||
end tell | ||
set zotRunning to do shell script "/usr/bin/curl 'http://localhost:23119/better-bibtex/cayw?probe=probe' 2>/dev/null; exit 0" | ||
if zotRunning is "" then | ||
display alert "This script will not work unless Zotero is running. Please launch Zotero and try again" | ||
tell application "Scrivener" | ||
display alert "Zotero not running" message "This script will not work unless Zotero is running. Please launch Zotero and try again" | ||
tell application appName | ||
activate | ||
end tell | ||
error number -128 | ||
else if zotRunning is "No endpoint found" then | ||
display alert "This script will not work unless Better BibTeX is installed. Please make sure that Better BibTeX is installed in the running instance of Zotero" | ||
tell application "Scrivener" | ||
display alert "Better BibTeX not installed" message "This script will not work unless Better BibTeX is installed. Please make sure that Better BibTeX is installed in the running instance of Zotero" | ||
tell application appName | ||
activate | ||
end tell | ||
error number -128 | ||
else if zotRunning is "ready" then | ||
set theReference to do shell script "/usr/bin/curl 'http://localhost:23119/better-bibtex/cayw?format=mmd' 2>/dev/null; exit 0" | ||
tell application "Scrivener" | ||
activate | ||
repeat until application "Scrivener" is frontmost | ||
try | ||
repeat until application appName is frontmost | ||
tell application appName to activate | ||
end repeat | ||
tell application "System Events" | ||
on error errMsg | ||
display alert errMsg | ||
end try | ||
tell application "System Events" | ||
try | ||
keystroke theReference | ||
end tell | ||
on error errMsg | ||
display alert errMsg | ||
end try | ||
end tell | ||
end if |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,38 @@ | ||
tell application "System Events" | ||
try | ||
set appName to (the name of every process whose frontmost is true) as string | ||
on error errMsg | ||
display alert "Problem" message "Could not get the name of the frontmost application." | ||
error number -128 | ||
end try | ||
end tell | ||
set zotRunning to do shell script "/usr/bin/curl 'http://localhost:23119/better-bibtex/cayw?probe=probe' 2>/dev/null; exit 0" | ||
if zotRunning is "" then | ||
display alert "This script will not work unless Zotero is running. Please launch Zotero and try again" | ||
tell application "Scrivener" | ||
display alert "Zotero not running" message "This script will not work unless Zotero is running. Please launch Zotero and try again" | ||
tell application appName | ||
activate | ||
end tell | ||
error number -128 | ||
else if zotRunning is "No endpoint found" then | ||
display alert "This script will not work unless Better BibTeX is installed. Please make sure that Better BibTeX is installed in the running instance of Zotero" | ||
tell application "Scrivener" | ||
display alert "Better BibTeX not installed" message "This script will not work unless Better BibTeX is installed. Please make sure that Better BibTeX is installed in the running instance of Zotero" | ||
tell application appName | ||
activate | ||
end tell | ||
error number -128 | ||
else if zotRunning is "ready" then | ||
set theReference to do shell script "/usr/bin/curl 'http://localhost:23119/better-bibtex/cayw?format=pandoc' 2>/dev/null; exit 0" | ||
tell application "Scrivener" | ||
activate | ||
repeat until application "Scrivener" is frontmost | ||
try | ||
repeat until application appName is frontmost | ||
tell application appName to activate | ||
end repeat | ||
tell application "System Events" | ||
on error errMsg | ||
display alert errMsg | ||
end try | ||
tell application "System Events" | ||
try | ||
keystroke theReference | ||
end tell | ||
on error errMsg | ||
display alert errMsg | ||
end try | ||
end tell | ||
end if |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,38 @@ | ||
tell application "System Events" | ||
try | ||
set appName to (the name of every process whose frontmost is true) as string | ||
on error errMsg | ||
display alert "Problem" message "Could not get the name of the frontmost application." | ||
error number -128 | ||
end try | ||
end tell | ||
set zotRunning to do shell script "/usr/bin/curl 'http://localhost:23119/better-bibtex/cayw?probe=probe' 2>/dev/null; exit 0" | ||
if zotRunning is "" then | ||
display alert "This script will not work unless Zotero is running. Please launch Zotero and try again" | ||
tell application "Scrivener" | ||
display alert "Zotero not running" message "This script will not work unless Zotero is running. Please launch Zotero and try again" | ||
tell application appName | ||
activate | ||
end tell | ||
error number -128 | ||
else if zotRunning is "No endpoint found" then | ||
display alert "This script will not work unless Better BibTeX is installed. Please make sure that Better BibTeX is installed in the running instance of Zotero" | ||
tell application "Scrivener" | ||
display alert "Better BibTeX not installed" message "This script will not work unless Better BibTeX is installed. Please make sure that Better BibTeX is installed in the running instance of Zotero" | ||
tell application appName | ||
activate | ||
end tell | ||
error number -128 | ||
else if zotRunning is "ready" then | ||
set theReference to do shell script "/usr/bin/curl 'http://localhost:23119/better-bibtex/cayw?format=scannable-cite' 2>/dev/null; exit 0" | ||
tell application "Scrivener" | ||
activate | ||
repeat until application "Scrivener" is frontmost | ||
try | ||
repeat until application appName is frontmost | ||
tell application appName to activate | ||
end repeat | ||
tell application "System Events" | ||
on error errMsg | ||
display alert errMsg | ||
end try | ||
tell application "System Events" | ||
try | ||
keystroke theReference | ||
end tell | ||
on error errMsg | ||
display alert errMsg | ||
end try | ||
end tell | ||
end if |