-
-
Save lodestone/748139 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/ruby | |
require 'sqlite3' | |
cite_part = ARGV[0] | |
db_name = "/Users/nernst/Library/Application\ Support/Mendeley\ Desktop/neil\@neilernst.net\@www.mendeley.com.sqlite" | |
db = SQLite3::Database.new( db_name ) | |
db.results_as_hash = true | |
query = "select citationkey, title, year from Documents where citationkey like '%#{cite_part}%'"#MATCH '#{cite_part}'"#{}like '%#{cite_part}%'" | |
db.execute( query ) do |row| | |
print row['citationKey'] + '|' | |
#print '@row:' + row['citationKey'] + "|" + row['title'] + "|" + row['year'].to_s | |
end |
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
on run {input, parameters} | |
set cite to input --"" --"jureta" | |
set delimitedList to {} | |
-- set test to "Carvalho2005a|Hayes2008|Sampaio2005|Sawyer2002|Searle1976|Baker|Denecker2002|Liu2009|Anbulagan2009" | |
set ssresult to do shell script "/Users/nernst/Desktop/query_cite.rb " & cite as string | |
set tid to AppleScript's text item delimiters | |
set AppleScript's text item delimiters to "|" | |
set delimitedList to every text item of ssresult | |
set y to choose from list delimitedList | |
set AppleScript's text item delimiters to tid | |
return y | |
end run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment