Jump to content

Mr Pennyworth

Member
  • Posts

    175
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by Mr Pennyworth

  1. @RCL hmm... that's very strange! both the parts about the terminal commands not working, and about the workflow still showing "x+y=z" I don't have access to a BigSur machine, but here's a last thing to try: 1. In the workflow, right-click on the script filter, and post a screenshot here so that I can double-check the exact code you're running 2. Keeping the debugger open, try "x^2+y^2" inside alfred and let me know what it renders and also the full text of the debugging output.
  2. @RCL hmm... yeah, it could be BigSur. I haven't tested on it. In the meanwhile, can you open the workflow folder in terminal (like in the screenshot) and then run the following command twice? open -a 'AsciiMath Renderer.app' 'asciimath://render?x^2+y^2' (on the first run, likely it won't show anything at all, hence twice) Basically, I want to figure out whether it has problem especially with powers or with anything that's longer that one letter... For that, it'll be awesome if you could try out something simple in alfred like "x+y=z" and see if renders or whether even in that case it is just "x"...
  3. @RCL I just tried x^2 and it did show correctly... can you run this command in terminal and confirm it just shows "x+y"? open -g "asciimath://render?x^2+y^2" Or, does it show x^2+y? Or, does it show x^2+y^2 correctly? Also make sure that "alfred filters results" is not checked in the workflow. (see screenshot)
  4. Would love to know more about your process behind figuring this out @deanishe! I opened network inspector, saw a bunch of XHRs fetching JSON and gave up thinking its all dynamic! 😁
  5. Try this for sec.gov: https://www.sec.gov/cgi-bin/browse-edgar?company={query} Example: https://www.sec.gov/cgi-bin/browse-edgar?company=twitter Sorry couldn't figure out the second one
  6. @lynxlinius@bazerman Here's (an admittedly non-feature-full) workflow that does that: https://www.alfredforum.com/topic/16164-thumbnails-and-titles-for-links-in-clipboard-history/
  7. For links that appear in Alfred's clipboard history, with this workflow: You can search using the title of the link (in addition to the URL) You can see a thumbnail of the link Usage instructions: Open alfred Type ".setup-clipboard-link-thumbnailer" (without the quotes) To go through links on clipboard, use the keyword "cliplinks", or set up a hotkey in the workflow. Download: Clipboard Links.alfredworkflow Example screenshot: What's not yet implemented (and is not very likely as I don't need these features): Link deletion Auto link deletion for links older than certain time (the way clipboard history does) Anyone who can program can implement these quite easily, and I'd be glad to accept patches: source code Privacy and other Qs: Q: Are these links sent somewhere to obtain screenshots? A: No. Screenshots are taken locally (see source code). Q: What kind of screenshot do I get for pages that are accessible only after a login? A: The same as if you opened that link without logging in. Q: What if I want some links to be ignored? A: Not presently possible, and not likely to be implemented by me as I don't currently need it. Q: What if I want all links copied from a certain app to be ignored? A: Add the app to "Features > Clipboard History > Advanced > Ignore Apps" in Alfred's preferences. (see screenshot below)
  8. Thanks @dunce for pointing that out! I had no idea about those shortcuts. They sure are handy! Definitely better than the arrow keys! I updated the workflow to incorporate ctrl+p and ctrl+n. (Use the same link in the main post)
  9. Agreed! Makes sense I just wanted to make sure that @lincoln knows that the specific thing (spotlight-like behavior for conversions) they want is possible, and there already exists a workflow to do just that. I think I'm frequenting these forums too much I could swear that I saw a short reply from someone to the effect "what you're asking is not possible". Now I see that there was no such reply! 😨
  10. @lincolnThis workflow does exactly that: https://github.com/biati-digital/alfred-calculate-anything No keyword is required. Limitation: the query must start with a number. If you are comfortable writing code, or do some tedious work manually, you can look at that workflow and see how it automatically triggers based on number, and extend the same logic to make it trigger based on currency identifiers too.
  11. @Naughty warrior it's been working for me... I just confirmed by downloading again What's the error that you get?
  12. Better Dictionaries Better search and live previews for built-in macOS dictionaries. This post might be outdated, link to up-to-date README Download the latest version: Better.Dictionaries.alfredworkflow Features IPA (phonetic) pronunciations: Press ⌘↩ to hear the pronunciation.In-Alfred live previews with colors that automatically adapt to Alfred's theme: Reverse search: More relevant search results: left: macOS/Alfred built-in search, right: BetterDict If one word has multiple, unrelated meanings with different origin, they are showed as diffrent entries (in the above example, see "arm" has two entries at the top)Import any compatible dictionary Setup After importing the workflow, first type .setup-better-dictionaries into Alfred and follow the instructions for granting permissions. Importing a Dictionary After setup, type .dict-import into Alfred. Select the dictionary you want to import. Dictionary-specific Keywords and Hotkeys After a dictionary is imported, a script filter and a hotkey trigger is automatically created into the workflow editor. Freshly-installed workflow without any imported dictionaries: Two hotkeys and keyword triggers each automatically added after importing two dictionaries. They come pre-labeled with dictionary names: This allows you to assign hotkeys and keywords for specific dictionaries. For example, below you can see how I have manually assigned keywords thesaurus and defn to the thesaurus and dictionary respectively. In addition, I can trigger the dictionary search using ⌃⌥⌘D. Word Lookup You can use the hotkeys/keywords created above for directly searhcing specific dictionaries. That's the recommended way for dictionaries that you use frequently. For the infrequently used dictionaries for which you haven't assigned any hotkeys/keywords, follow this: 1. Type lookup into Alfred. You'll see a list of all dictionaries imported into BetterDict. 2. Select the dictionary to search, and type the search query. Notes and Warnings [*]Importing a dictionary could take as much as 30 minutes on old machines or if there's significant CPU activity from other apps.[*]After each mac restart, for the first time when you run the workflow, expect a comparatively slower search. Subsequent searches should be instant.[*]This workflow takes a LOT of space on disk. Take a look at the comparison: # Built-in dictionaries Oxford Thesaurus: 7 MB Oxford Dictionary: 36 MB # After importing into BetterDict Oxford Thesaurus: 101 MB (html files) Oxford Dictionary: 442 MB (html files) Search index for two: 730 MB (apart from html) Known IssuesThe workflow doeesn't work if the theme is Alfred Classic. If you must use that theme, duplicate that theme and use the duplicated one.
  13. This has a demo for such a workflow. Dictionary with large preview pane. (the dictionary part of code is way too messy to share right now, but you can play around with the preview pane) Update:
  14. This tool does precisely that! (a tool for workflow creators to add webview to their items)
  15. Link to better quality videos Download the code and play around: https://github.com/mr-pennyworth/alfred-extra-pane Q: What is it? A: An app that workflow creators can add to their script filters Q: What does it do? A: It renders html from quicklookurl of every item in the json. Q: How does it do it? A: By intercepting the json and by monitoring up-arrow and down-arrow keypresses. Q: How to add it to a workflow? A: By adding it to the script filter. Here's an example (from the workflow in the above GIF): notice how everything remains the same, just that at the very end, json needs to be piped through the helper app # Before: query=$1 PATH=/usr/local/bin:$PATH items=$(curl 'http://127.0.0.1:7700/indexes/dictionary/search' --data "{ \"q\": \"$query\" }" | jq '.hits') echo "{ \"items\": $items }" # After: query=$1 PATH=/usr/local/bin:$PATH items=$(curl 'http://127.0.0.1:7700/indexes/dictionary/search' --data "{ \"q\": \"$query\" }" | jq '.hits') echo "{ \"items\": $items }" | 'AlfredExtraPane.app/Contents/Resources/scripts/alfred-extra-pane' Q: Sounds great! Now tell me everything that's not working! A: This is more of a proof-of-concept and very rough around the edges. Things that are easily doable, but haven't been done yet (contributions welcome! ) change appearance automatically based on alfred's theme make other things configurable like dimensions Things that seem doable, but quite difficult with my knowledge of macOS GUI programming (which is about a week) let alfred remain horizontally-centered when the pane is not present, and when the pane appears, make the "alfred+pane" combination horizontally-centered (by moving both the pane and alfred window to left) Things that seem doable, but require guessing about alfred's inner workings: as @deanishe points out, alfred builds "uid-based-knowledge". that means if the returned json has an uid field, alfed can use that later to re-order items while displaying based on whether of them were previously actioned on. the knowledge is an sqlite database, so that's the easy part. the not-trivial part is to figure out how alfred sorts the items. Workaround: if you want to use this tool in your workflow, don't add UIDs to your json. One perfect use case for this is the dictionary workflow in the GIF. You looking up a word in the dictionary is a very weak signal that the word is important (many times, it is actually a signal that it is now less likely that the word will be looked up) This is a GUESS based on LIMITED observation. sorting is based on 1) how many times an item has been actioned (freq) 2) latest timestamp of action (timestamp) primarily sorted based on freq, ties are broken by timestamp special case: if the script filter has executed without an argument, and one of the resultant items has an entry in the latching table, the item goes to the top, irrespective of the above sorting. The above algorithm has been implemented and seems to match alfred's sorting. Things that seem impossible to me: take into account mouse scroll interactions. right now, when selected row changes because of a mouse hover, the pane doesn't update, and will continue to show the old preview. As mouse hovers over various rows, the pane updates correctly, as long as Alfred's results have not been scrolled using mouse.
  16. Great to see it running! Can you tell me what exactly did you do to make the permissions error go away? (So that I can add those steps to "troubleshooting" instructions in the original post) About the "Warning! Leak!" errors, it is a long standing issue with the OCR library, and I couldn't find any easy way to fix it. However, as the program is not a long-running one, but it runs every time an image is added and then quits, the leak warnings aren't something to worry about. About the quality of OCR, yep, it is rough However, I wouldn't worry too much about what is seen in the visible part of of clipboard history viewer. Take a look at the example below: the OCR has incorrectly "recognized" weird characters like ="... Also, the actual words "member", "38", "posts" aren't even visible in the title. But as can bee seen from the example, those words exist, and you can search using them. For further explanation, see the image below: This is the screenshot of the relevant entry in Alfred's clipboard database. As you can see, the OCR library almost correctly recognized the words, but also recognized garbage characters in the avatar. Alfred's built-in viewer (in the above screenshot) shows only the first line of each database entry, hence, in the titles that you mention, you won't be able to see the rest of the text. But that's okay IMO. When you search for "member" or "38 posts", it shows up, and that's good for rudimentary searching I'm sure the tesseract library can be fine-tuned for things like "only output text that has a confidence level of more than 90%" or something like that. I just haven't really found the need to spend time to figure it out yet Reminder: Can you tell me what exactly did you do to make the disk-access permissions error go away? (So that I can add those steps to "troubleshooting" instructions in the original post)
  17. These discussions seem relevant: https://stackoverflow.com/questions/58479686/permissionerror-errno-1-operation-not-permitted-after-macos-catalina-update https://stackoverflow.com/a/60500021 Especially the second link, just the way that answer adds /bin/bash to full disk access, you could try adding /usr/bin/python to full disk access...
  18. Whoops! Thanks for pointing it out! Updated the workflow. Should work for 10.13 and up now, although I have no means of testing...
  19. My fashcard software supports neither LaTeX nor MathML. Given that image is the only way to go, I created this workflow where you, Open Alfred Type ` (backtick) Start typing a math expression in AsciiMath syntax. As soon as you start typing, another window opens and it displays the typesetted math in real time as you type. Pressing enter closes both alfred and the math window, and puts a PNG image into clipboard. Instead of pressing enter, if you pressed command + enter, it copies LaTeX instead of the image to clipboard. Q: Why AsciiMath? A: Because it is extremely concise and intuitive. Check out this handy list of asciimath-vs-latex comparison examples. Q: What if I don't know how to write a particular thing in AsciiMath? A: If you are stuck in middle of typing, just stop, hit shift, and it'll pop up a reference. When done consulting the reference, hit escape again, and start typing from where you left off! (see gif below) Meta: A thing that I find exciting is this gives an example of a "rich preview as you type" workflow. Broad Technical details: custom protocol URLs: gives a cheap one-way-server functionality, ie, a way for alfred scripts to communicate with the running app, instead of launching an app every script invocation, or, running a server manually in the app (or some other complicated IPC scheme) monitor window events so that even if the user presses escape and quits the workflow without actioning, the math window can be hidden Download: AsciiMath.alfredworkflow
  20. Hadn't even stopped to think about this! Just because I was generating the plist like a template in bash, I did the same with the python file. Your suggestions make so much more sense! Thanks! I've updated the workflow accordingly.
  21. Edit: If my specific ocr.py file is included, the first invocation of the launch agent will fail. That's because the launch agent is loaded first and python file is overwritten next. I updated the workflow in two ways to fix this: first create the python file and then load the launch agent remove the bundled ocr.py file from the workflow (just to be safe) Thanks so much for spotting it! Original Reply: Whoops! Didn't mean to include the `ocr.py` file. However, it'll get overwritten when `.clipboard-history-ocr-install` is run. Before posting I tested on another mac with a different username and it worked. Here's the part where the ocr.py file gets overwritten with user-specific settings:
  22. Clipboard History OCR for Alfred Make images in Alfred's clipboard history searchable by their text content. This post might be outdated: up-to-date readme. Download the latest release. Alfred's clipboard history includes images too. However, there's no way to search through them. For example, in the screenshots below, are two images in the clipboard history, but the only "searchable" information about them is dimensions and size. This tool runs OCR every time an image is copied to clipboard, and makes the image searchable using that text. Setup Download the latest release.Type .clipboard-history-ocr-installDone! Uninstall Run .clipboard-history-ocr-uninstall in Alfred.Delete the workflow from Alfred. Credits Tesseract OCRMac dilyb bundlerIcon made by combining icons from flaticon by Pixel Perfect and Dimitry Miroliubov.
  23. "get info" on the app -> add the text "alfred:ignore" (without the quotes) to the comments section of the "get info" window.
×
×
  • Create New...