Jump to content

iandol

Member
  • Posts

    154
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by iandol

  1. Actually, when Ruby errors, then the workflow halts and the other Alfred options blocks do not run. I have the line that errors wrapped in an exception block: begin response = Net::HTTP.get(uri) rescue Net::ReadTimeout => e response = '' end But I see this in the debug: [07:39:35.463] ERROR: Bookends Tools[Script Filter] Code 1: /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/uri/rfc3986_parser.rb:67:in `split': bad URI(is not URI?): "127.0.0.1:16005" (URI::InvalidURIError) from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/uri/rfc3986_parser.rb:73:in `parse' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/uri/common.rb:234:in `parse' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/uri/generic.rb:1542:in `find_proxy' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/http.rb:1109:in `proxy_uri' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/http.rb:1096:in `proxy?' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/http.rb:936:in `connect' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/http.rb:930:in `do_start' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/http.rb:919:in `start' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/http.rb:605:in `start' from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/net/http.rb:481:in `get_response' ... And then nothing gets printed from my debug block: ALSO, I realise that I cannot change the environment variables from within Ruby, as it is a child process so it only works on copies of the ENV sent to it from Alfred. I suppose I must modify the stdout to something that can be parsed to determine an error...
  2. I have a problem with ruby net:http library conditionally failing depending on whether the macOS system proxy is enabled or not. Currently my script just silently fails and Alfred shows the default searches. To know there was an error, one needs to go into the workflow editor debug mode. Does anyone have any tips how to handle script errors so they trigger a notification or some other method. My idea is to set an environment variable at the end of the script, and if that isn't set then Alfred's args and vars can do something conditional -- does that make sense?
  3. Sorry for the late reply, I don't check here very often. scopusSearch needs a DOI in the Bookends ref to work, and you may need to generate your own API key... EDIT: actually there was a small change in the Bookends Applescript interface that causes the grab-selected-DOI to fail. I will make a fix and update tomorrow.
  4. OK, well the voodoo that fixed this was: safe boot + reinstall the 10.15.4 combo update...
  5. Trying to run an Alfred workflow and I kept getting this error: Code 1: osascript: no such component "JavaScript". A google search turns up an Alfred forum post and linked think different post suggesting to delete ~/Library/Preferences/com.apple.ScriptEditor2.plist and reboot. But in my case it didn't solve anything. Not only Javascript is missing, Applescript too: Confirmed on the command line (osalang -l), although my Applescript and Javascript components are present in /System/Library/Components... ➜ osalang -l ...crickets ➜ ll /System/Library/Components total 0 drwxr-xr-x 8 root wheel 256B Jul 12 2019 ./ drwxr-xr-x 116 root wheel 3.6K Aug 1 2019 ../ drwxr-xr-x 3 root wheel 96B Jul 6 2019 AUSpeechSynthesis.component/ drwxr-xr-x 3 root wheel 96B Jul 6 2019 AppleScript.component/ drwxr-xr-x 3 root wheel 96B Jul 6 2019 AudioCodecs.component/ drwxr-xr-x 3 root wheel 96B Jul 9 2019 AudioDSP.component/ drwxr-xr-x 3 root wheel 96B Jul 9 2019 CoreAudio.component/ drwxr-xr-x 3 root wheel 96B Jul 6 2019 JavaScript.component/ I know this isn't an Alfred problem (though as most of my osascript is run via Alfred, this is where the problem manifests), but do any of you smart scripters have an idea of what I can do to fix this? A clean installed macOS 10.15.4 (19E287) on a mid-2015 iMac that was working pretty fine up till now. I tried reinstalled command-line tools just in case.
  6. I often want to get a selection from the current app to pass as argv to a script. Using the [hotkey] trigger this is trivial, but I normally want to be able to use both a [hotkey] and/or a [keyword]. Now the issue is [keyword] as an input does not support passing a "Selection in macOS" argument. The way I currently handle this is [keyword] triggers a script action Applescript to copy the selection (system events) to the clipboard then have two scripts, one that handles stdin via [hotkey] and one that uses the clipboard from [keyword]. But this seems a bit fussy (and fills up the clipboard in one but not the other trigger). I also sometimes use [hotkey] to also trigger an applescript>clipboard then have a unified script but we still are using the clipboard when we don't really have to. If we had a new dedicated [action] which simply passed the current selection to the next block it would elegantly solve this (my [keyword] would then trigger this new [action] to pass into a single argv script). I know this is fairly minor and there are workarounds and perhaps I'm missing a better way to do all this, but if not please consider adding this action, thank you!
  7. V1.2.9 is released: add a new workflow variable tempCitationStyle that sets the default temporary citation format for becite / betitle/ beall. When unset it will be the Bookends standard, but you can set the variable to Pandoc / MMD / LaTeX to paste the citation in a different format ([@key] / [#key] / \cite[]{key}). If the authors field is empty for a reference, we now try to use editor names instead in the Alfred results list.
  8. So my usecase is that my workflow interfaces with Bookends bibliography software, and a user can have 2 or more PDFs attached to a reference. Quicklook is designed to handle multiple files passed to it (you can test with qlmanage -p), and so it would be nice if the quicklookurl key in the Alfred JSON format would accept an array as well as a string. That way Alfred could pass multiple files to QL for previewing. Thanks for your consideration.
  9. Thank you vitor. So I hope Andrew will be able to update Alfred to read an array of paths to pass to QL. ?‍♂️?
  10. Hi, I have a new question: if I want to pass more than one file to QL via Alfred, is this possible, and how? This is possible for QL (pass multiple files via qlmanage -p for example), but Alfred may not parse the url string to pass as seperate items. On the command line (qlmanage -p) using a single string input, I tried separating within the string using space, comma, colon but none worked (you have to use multiple inputs). Thanks for any help!
  11. Updated to V1.2.8 which adds phrase search delimited by single quotation marks (without quoting words are searched in any location/order): https://github.com/iandol/bookends-tools/releases/tag/V1.2.8 Also just to remind you, if you want Quicklook to work, you should change the attachmentsFolder variable to point to your Bookends attachments path. All PDFs should be in the same folder, as it would be too slow to try to find the path automatically…
  12. @taja — does V1.2.5 handle the large results list? I've not tested with such a large number, but the error you show is the same as previously, and it doesn't make too much sense. It occurs when processing the author initial, but I've tested authors who have a comma after the family name but no first name or initials and it should work. I've added more defensive checks to try to not trigger this error. Please download the updated script manually and run it from the command line for testing or you can replace the version in your installed workflow: https://github.com/iandol/bookends-tools/blob/master/source/findReferencesAll.rb Let me know if it works, I don't think this is to do with lots of results, but references that have mangled author names or something, and that large search is revealing the issue...
  13. @taja — ok, the new author parsing didn't handle empty author fields, this wasn't an issue for becite, but was for beall. For the next release I should retrieve both authors and editors, and use editors if authors is empty, but I don't have time to do that for now, so author becomes "Unknown"... V1.2.7 released, please retest and let me know how it goes.
  14. @vitor — thanks for the confirmation, and the excellent updater! @Cassady — I'm a bit confused, BE Tools already uses OneUpdater, the settings appear correct and all 11 tools are connected to it. So it should not need any manual configuration, but be triggered when any tool executes.
  15. Hi taja, OK that is my fault, I'll make an updated V1.2.5 soon. EDIT: V1.2.6 is released! https://github.com/iandol/bookends-tools/releases Cassady: actually I've never tested OneUpdater, so possibly I'm doing something wrong. @vitor — do these setting look OK (I normally set frequency to 4)?
  16. Haven't had a chance to play with it yet, but hopefully I'll get some time this week!!! ?
  17. I've just released V1.2.5, which presents the first AND last author names with initials to provide a bit more context for the search results. And I realised that I can get Quicklook for attachments working in Alfred (thanks to input from vitor and deanishe). This is really cool: so you search, focus a results item with an attachment (denoted by the ?) then press [shift] or [⌘][Y] and you can quicklook the PDF directly without Alfred losing focus so you can check the paper before inserting the citation. https://github.com/iandol/bookends-tools/releases/tag/V1.2.5 — or wait for OneUpdater to update for you.
  18. As always, Alfred is one step ahead of me, thank you so much!!!
  19. We can already quicklook normal Alfred entries, but I would really like to be able to quicklook entries in the script filter output. I realise this is not straightforward, in that the script filter JSON would need to be modified contain a new field that would be the file target Alfred would then send to `qlmanage -p` — but if we could select an filter entry, ⌘Y it and get the quicklook window without losing focus of the Alfred list it would be phenomenal. My idea is that if there is no JSON entry or it is empty, then ⌘Y does nothing (i.e. nonbreaking backwards compatible), if it is present and a file path, then QL that file. Thanks for your consideration!
  20. Thank you!!! So my wish now is to add this information to the Help page: https://www.alfredapp.com/help/features/clipboard/
  21. Hi, for those of us that use browser-extension password tools (lastpass, bitWarden, 1password etc.), these mostly work by using the clipboard (extensions don't seem to be able to tag clipboard contents as sensitive and cannot be added to the exclusion list). This means sensitive passwords can end up in the clipboard manager. I know we can Clear last 5/15 mins but sometimes we may forget and don't want to blitz our whole history... I was wondering if we could add the ability to delete single clipboard entries. I envisage in the Clipboard viewer we could focus an entry then use a modifier like [⌥][↵] to delete just that entry? Thanks for considering this.
  22. Just released V1.2.4 — becite/betitle/beall now shows if a reference has an attachment, and for Bookends 13.x users use the new applescript JSON events that are slightly more efficient.
  23. Hi @taja, do you normally use ⌘⇧O to do this? I tried to make it automatic (use ⇧ and ref opens and attachment if present otherwise nothing) but the problem is if there is no attachment it opens an attachment from the previously selected ref that does have an attachment even though a reference without an attachment is selected... I added it using another modifier [fn] — can you test if V1.2.3 does what you want it to? I've now used up all available modifiers (⌘, ⌥, ⌃, ⇧ and [fn])!
  24. V1.2.2 released, with only a small fix for the new API of the Scopus Search tool...
×
×
  • Create New...