Jump to content

Mr Pennyworth

Member
  • Posts

    171
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by Mr Pennyworth

  1. Damn! @Florian See if you can figure out the css selector of that dialog? Then you can add that selector to this list here: https://github.com/mr-pennyworth/alfred-google/blob/main/google-viewer/AlfredGoogleViewer/main.swift#L13 and then recompile the app with ./build-scripts/mkapp.sh
  2. Cool stuff!! But looks like unrelated to what I meant by "search google as you type"... Unless of course, I'm missing something... How do you envision algolia autocomplete to be used to search google for quick answers?
  3. I started with the comment solution because I wanted to use spotlight as a junk drawer. Have you written your process down somewhere? Would love to read a detailed "how to convert applescript to JXA"
  4. By "result" I mean "item" in the following. I'm not sure what's the correct term 😝 "everything is a result" is an interesting philosophy. Reminds me of "everything is a file" philosophy of Unix. The universality brings simplicity and elegance too, no doubt! However, the discussion of a third "valid:" state made me wonder... (consideration of complexity and elegance aside) What if everything is not a result? If a result isn't valid, is it really a result? After all, nothing could be done with it. Alfred already has specialized UIs, they are just not exposed to the workflows: Snippet and Clipboard History Viewer Mini Music Player The tiny "update available" notice What if Alfred exposed more UI elements for workflow authors? Given how elegantly crafted the whole workflow editor is, there's no doubt @Andrew could make a few well-designed, judiciously-crafted UI elements that fit into Alfred beautifully. To my naive eye, it looks like Alfred could benefit from a "notice" element. The notice could be used as a status indicator a progress monitor an error flag Someone could even go ahead and build a breadcrumbs UI using the notice. (would be cool for multi-level-menus (I gather @deanishe would love better support for building multi-level-menus)) An example from Raycast (By a "notice element", I mean something like "Clipboard History" at the top left): I understand that it's possible that this could be a stretch. Also, it could be seen as "beginning of cluttering of UI". It's just that I keep having this feeling that "valid: false" results don't belong with the main results, philosophically. So throwing this out here for discussion
  5. @Florian [pre-release] There you go: https://github.com/mr-pennyworth/alfred-google/releases Note: The reason the workflow doesn't directly visit a google search url each time, but instead loads a google search page and fills input values and submits forms is because the former led to captchas pretty soon, I guess the latter is more "human like"... The app in the workflow is basically the app in https://github.com/mr-pennyworth/alfred-gif with large chunks of code deleted. The Google workflow has a one-way flow, btw. That is, the webview responds to alfred. For a back-and-forth interaction, you can take a look at the GIF workflow. It has file drag and drop, keyboard and mouse navigation etc. My apologies, the GIF workflow code is damn messy and convoluted though. Just the current one through the new press secretary. However, if the results are coming from a script filter, you could independently capture and process those. That's what the extra pane did pre-press-secretary. Take a look at the tech QA: https://github.com/mr-pennyworth/alfred-extra-pane#technical-qa (I haven't pushed the press-secretary code to alfred-extra-pane yet.) https://github.com/mr-pennyworth/alfred-extra-pane#-in-script-filters-alfred-doesnt-simply-show-the-results-in-the-orderthey-appear-in-the-json-but-reorders-them-according-to-its-logic-how-doesthe-extra-pane-account-for-that- Excited to see what you build!
  6. Thanks @Alfred0! My most favorite use-case is actually something that I hadn't originally thought about: "Search Google as You Type" Google has become more and more of a question-answering-machine. So many times, I just want a quick answer and am not looking at reading articles/blogs etc. For those cases, the mode of operation is "search google -> look at result -> move on". The extra pane fits so well for them! And ofc, pressing enter would open the same page in browser if I want to interact with that page further. @Andrew The above involved writing this script filter: I would agree that writing such a script filter is a minimal-effort, no-hassle thing. It does feel like a teeny-tiny duplication-of-function though, given that Alfred already has awesome web-searches. Is there a way to access the URL the web-searches are building? Or, would it be possible to expose those URLs through press-secretary? Or, is that not desirable due to privacy concerns? Also, is there a programmatic way of accessing the web-searches? cc: @deanishe @vitor (that way, someone could programmatically build a workflow mirroring the web-searches and their keywords if they want) I scoured through various plists and alfdbs, but couldn't find where they are stored... Are they stored in some proprietary format / right inside the binary? Or did I miss something obvious? Having said all this, I must agree I don't really foresee much value in doing this for all web-searches because with the exception of google and wolframalpha, I would assume most of the searches are such that they require further interactions with results (like clicking a link, copying some text etc). Aside: Here's a different (vertical) configuration I've been toying with:
  7. @vitor I use this command: # A file action (that allows multiple files) # The file action writes the files to /tmp/alfred-ignorelist, then calls the script cat /tmp/alfred-ignorelist | /usr/local/opt/findutils/libexec/gnubin/xargs -d'\n' -i -n1 osascript -e 'on run {f, c}' -e 'tell app "Finder" to set comment of (POSIX file f as alias) to c' -e end "{}" "alfred:ignore" rm /tmp/alfred-ignorelist # for recursively ignoring everything inside a folder find -L /path/to/folder | /usr/local/opt/findutils/libexec/gnubin/xargs -d'\n' -i -n1 osascript -e 'on run {f, c}' -e 'tell app "Finder" to set comment of (POSIX file f as alias) to c' -e end "{}" "alfred:ignore"
  8. @evanfuchs aha! got it! That's such a bad bug!! Thanks so much for reporting it I fixed it in v0.0.5, download it and give it a go
  9. @evanfuchs sorry, I'm confused... Can you give me a step-by-step detailed explanation of what you expect to happen and what actually happens? From your description, it seems like it is working correctly... you hit ⌘C, then go about doing something then, when you want to paste the GIF, you hit ⌘V the gif should be pasted. Is it not being pasted? BTW, the workflow doesn't put image data onto the clipboard, it simply puts a file onto the clipboard. That's the file you are seeing in clipboard viewer. Can you elaborate what the expected behavior is?
  10. Sounds like a bug to me. Not because the way it behaves, but because the way it inconsistently behaves. This what's happening with @luckman212: This is what's happening with me: Start with deleting all "ocr" related rows from both "knowledge" and "latching" tables TextSniper.app shows at top Type "ocr" an then ⌘2 to latch something other than the text sniper app Now on, text sniper app is no longer at the top when typed "ocr" Both of us are on build# 1205 I'm on Catalina @luckman212 is on BigSur Going by luckman212's report there seem to be two possibilities: on their machine: either the row in latching table is not being created/updated (even after many ⌘2's) (SQlite connection / adapter bug?) What about the knowledge table, you ask? -> it shouldn't matter because both of us have cleared it before the experiment or Alfred's behavior somehow diverges between Catalina and BigSur or, of course, a third thing that I completely missed 😝 @Andrew @deanishe do you guys think it makes more sense to move this to "bugs" category?
  11. Ouch. Sorry for the useless instructions! Seems like a headscratcher! Would've been fun to debug, but can't reproduce the buggy behavior Shouldn't have asked Andrew to chime in for such a simple thing! Turns out, latching starts out with "strong" == 0 and one more invocation makes "strong" == 1 and it remains that way. If a competing latching is about to occur, if strong is 1, it simply becomes 0 and the competing latching doesn't materialize. Seems like a cool way of being forgiving for one-off mistakes when made infrequently!
  12. @luckman212 Good point! There's a caveat though: If you want to tell Alfred to rank "select screen area" above "TextSnip.app" when you type "ocr" (just the keyword, and no extra argument) the only way to do that is "cmd+2" after "ocr" (without any extra argument) (as opposed to typing additional letters, getting "select screen area" to top, and then pressing enter) I'm not saying you don't know this already. You probably know this, or this might be new; I can't be certain either way. So, for clarity and written reference, here goes: A user might type "ocr s", get "select screen area" as first option, and press enter. The user might do that again and again and again, say, 100 times. It would surely create a feeling that the user is using the keyword "ocr" a lot, and hence, training Alfred to go for "select screen area" for "ocr". But technically, all that training gets superseded (as far as just "ocr" is concerned) by a single instance of the following: user types "ocr" (without space or arguments) assume, "TextSnip.app" is the 4th result presses cmd+4 TextSnip.app is launched now on, when the user types "ocr" (without space or arguments), TextSnip.app ranks at the top. For exact keywords, entries in latching table outrank entries in the knowledge table Hence one usage of "ocr" -> "TextSnip.app" outranks hundreds of usages of "ocr se" -> "select screen area" @luckman212, out of curiosity, when you said you use the "ocr" keyword a lot, did you mean the exact letters "ocr", followed by ⌘+<number> to choose from results OR "ocr" followed by an optional space, and then some letter, so that the desired result comes to top, then press enter?
  13. This is a claim that could be experimentally verified, no? This is the list filter I used for the experiment: After running those two SQL queries, and following step (1) and (2) from my previous answer, here's what I get: @luckman212 are you certain that on your machine (both our builds are same 1205) Alfred *always* ranks app results above list filter results? Did you delete those "ocr" related DB rows, then follow (2) and still end up with textsniper.app ranking above your list filter results? That sounds like a very strange bug to me...
  14. Looking at the "knowledge" and "latching" databases, this doesn't seem to be the case. Alfred always keeps learning... What is not immediately clear from the DBs is how any particular latching becomes "strong" and stops being "strong". @Andrew is this part of Alfred's secret-sauce or is it something you don't mind shedding more light on?
  15. I guess once something gets strongly latched, it becomes very difficult to unlatch it(?) So instead of trying to move the app down, let's try simply removing the latching? @luckman212 @deanishe Here's what worked for me: Clear Alfred's knowledge ➑ sqlite3 ~/Library/Application\ Support/Alfred/Databases/knowledge.alfdb SQLite version 3.28.0 2019-04-16 19:49:53 Enter ".help" for usage hints. sqlite> DELETE FROM latching WHERE keyword == "ocr"; sqlite> DELETE FROM knowledge WHERE keyword == "ocr"; Type "ocr" in Alfred, press "⌘-2" (to select "select screen area"). Now on, after typing "ocr", "select screen area" is the first result, not "TextSniper.app" Note that this doesn't really do exactly what @luckman212 asked, it just effectively pushed the app down by one, and moved "select screen area" up to the top. To push the app all the way down (after clearing the latching and knowledge rows), you gotta repeat step 2 above for all the options in your list filter
  16. Deleting a bunch of code is so satisfying! no more mouse tracking no more keypress monitoring no more accessibility hoops to get window events and sizes no more guessing "how does Alfred rank results?"
  17. @Andrew Getting them all now! πŸŽ‰ Getting selection.changed only on keypresses though, not on mouse-hover...
  18. @Andrew I'm so sorry this is likely such a n00b question! I'm only seeing window.hidden notifs. I don't seem to be able to catch the others... The extra-pane was the first time I'm writing swift, (or any mac-related programming for that matter) So likely it is something really dumb that I'm doing... DistributedNotificationCenter.default().addObserver( forName: NSNotification.Name(rawValue: "alfred.presssecretary"), object: nil, queue: nil, using: { notification in NSLog("\(notification)") } ) I just wanted to confirm that the notifications are posted with DistributedNotificationCenter.Options.deliverImmediately I'm not really sure whether it is the poster's responsibility or the observer's... Assuming the observer can ensure immediate delivery irrespective of how the poster posted the notifications, I tried this code: #import <Foundation/Foundation.h> static void callback( CFNotificationCenterRef center, void *observer, CFStringRef name_cf, const void *object, CFDictionaryRef userInfo ) { NSLog(@"event: %@", (__bridge NSString*)name_cf); NSLog(@"user info: %@", userInfo); NSLog(@"object: %@", (__bridge id)object); return; } int main(int argc, const char * argv[]) { NSString* name = @"alfred.presssecretary"; CFNotificationCenterAddObserver( CFNotificationCenterGetDistributedCenter(), nil, callback, (CFStringRef) name, nil, CFNotificationSuspensionBehaviorDeliverImmediately); [[NSRunLoop currentRunLoop] run]; return 0; } The results are still the same, I only get the "window.hidden" notifs and none of the other types...
  19. @lynxlinius here's an alternative GIF workflow (it uses tenor instead of giphy)
  20. Hi @Andrew, I forgot to ask this last time! How do I find out when this lands in Alfred? Right now, after each pre-release build update, I run the following two commands and see if there's anything of interest there: defaults read com.runningwithcrayons.Alfred defaults read com.runningwithcrayons.Alfred-Preferences Is that the correct way of checking?
  21. @runningwithscissors: Here's a modified one where in addition to the original workflow, it also changes any double spaces to a single space. http://www.mediafire.com/file/oze6vq4pucs7qnq/Paste_without_newlines.alfredworkflow/file
  22. @flome Seems like BigSur has some weird issues: https://developer.apple.com/forums/thread/665661 Try this command in terminal: launchctl load -wF ~/Library/LaunchAgents/alfred-clipboard-history-ocr.plist (It is a one-time thing)
×
×
  • Create New...