Jump to content

All Activity

This stream auto-updates     

  1. Today
  2. Man I really went down a rabbit hole on this one. But, thanks for the guidance @deanishe ! I finally got this working the way I want with a Script Filter (as you suggested) and some help from jq. There were some rough spots, because mdfind -onlyin does not accept multiple folders, nor a complex query using kMDItemPath. So I had to string together 2 commands into a variable. It was also "fun" wrestling with jq's syntax to parse the tab separated input, filter out nulls etc. This is most certainly better done in Python but I wasn't sure how to get the Spotlight results and was in a bit of a hurry. So yeah I'm sure there are better ways to do this... In case anyone is curious, here's how I did it: /bin/bash tab=$'\t' query='kMDItemContentTypeTree == "public.image"d && kMDItemContentModificationDate >= $time.today(-3d)' results=$({ mdfind -onlyin ~/Desktop $query; mdfind -onlyin ~/Downloads $query; }) if [ -z "$results" ]; then cat <<-EOJ { "items": [{ "title": "No recent images found", "valid": false, "subtitle": "no recent images found in Desktop or Downloads", "icon": { "path": "error.png" } }]} EOJ exit fi tsv=$(while IFS= read -r FILE; do fname="${FILE##*/}" fullpath="$FILE" dirname="$(dirname "$FILE")" fdate="$(date -r "$FILE" +'%a %-m-%-d-%Y %-l:%M%p')" echo "$fname${tab}$fullpath${tab}$dirname${tab}$fdate" done <<<"$results") /usr/local/bin/jq --slurp --raw-input '{ items: [ split("\n")[] | split("\t") | select(.[0] != null) | { title: .[0], arg: .[1], subtitle: .[2], mods: { shift: { valid: true, arg: .[1], subtitle: .[3] } }, text: { copy: .[1], largetype: .[1] }, icon: { type: "fileicon", path: .[1] } }]}' <<<"$tsv"
  3. You may get a hint looking inside the new Music.app for the URL schemes in its Info.plist
  4. Thanks anyway! I'll probably stay with the new replacements of iTunes. Maybe I'll be able to fix the bug, when I have a bit more time on the weekend.
  5. Most likely. Sadly, I will not be able to reproduce as I have no intention of moving to Catalina. Also, it's possible to install iTunes etc on Catalina: https://appleinsider.com/articles/19/10/28/free-retroactive-tool-brings-aperture-itunes-back-to-life-in-macos-catalina
  6. Yes, that is exactly what is the problem, probably, since there is no iTunes anymore.
  7. Thanks. I actually prefer to avoid clicking menu items but I'll compare performance and consider integrating your change that in future!
  8. Are you running Catalina by any chance?
  9. I was not able to find that URL easily, though I have no expertise in that. If I fix it in the future, I will post the updated URL here. Removing the "app=music" shows iTunes Store results in Apple Music. "itms://itunes.apple.com/WebObjects/MZStore.woa/wa/search?app=music&term=%s" Maybe the Apple Music API can help?
  10. Interesting! I don't have time to fix - paid work takes precedence at the moment - but it should be simple enough to track down the correct URL for that type of search.
  11. Hey @gingerbeardman. The workflow is really great! However, I have one problem: When I am searching for song/artists/albums the results in Alfred work great. If, however, I hit the first option "Search Apple Music for songs matching <some name>", Apple Music opens and displays a spinning wheel loading animation in the middle of the screen which never ends. Thanks, McLawrence
  12. I've not seen any issues until recently – hence raising it here. It looks like something's changed (I guess either in my machine's boot order, or in DriveFS) that now means it's slower to mount compared to the speed which Alfred expects it to be there, and so I'm seeing this error for the first time. Thanks for your response though, both
  13. Yesterday
  14. Have you granted Alfred "Full Disk Access" in System Preferences?
  15. Complain to Apple. Catalina blocks other applications from searching Mail.app's email.
  16. On Catalina here, latest version of Alfred and powerpack user. The only option that actually works is "email" (for sending an email). All the others revert to a web search. I am using the native Mail client. Any idea on how to fix this?
  17. Hi there, I've tried to enable this a few times with no luck. I tried to move my preferences folder to my HD rather than iCloud but no luck. Can anyone advise on how to set the variables? I think maybe I am writing the wrong path for the snippets folder...
  18. You’re on your own for that one. I’ve already made two throwaway Spotify accounts to make and improve the Workflow, and have no desire to make a third one to debug a localisation issue that may lie out of our ability to fix (e.g. bug in JXA). It’s not your fault you didn’t specify you use Spotify in a non-english language (how would you know that could be relevant?), but that’s also a tad more work than what I feel like dedicating on this endeavour.
  19. Hello, I'm still struggling to find a way to replicate Alfred's "move" file action in the Devonthink world: files selected --> moved to Devonthink group. @brunoc made a very good job here (https://www.alfredforum.com/topic/10630-devonthink-browser-file-action/?tab=comments#comment-54406) but 1. I'm no more able to make it work and 2. the approach used limits how deep in DT hierarchy Alfred can search. I found a script in DT forum that takes another approach searching a user entered string in opened DT database groups and gives you a list of groups with that string in the name. The author made it to work with Launchbar (see here the script: https://discourse.devontechnologies.com/t/quickly-find-a-group-in-any-open-db-launchbar-operations/11571/11) so the final workflow is: - select a file in finder -invoke the script - in the script you're prompted to write a search string - the script returns a list of group(s) where the search string is found - user select a group - launchbar moves the file to the appropriate DT group Now the quick question is: is it possible to use the same (or a modified) script in Alfred? I think it would be very useful but I'm not so techie to do it 😢
  20. @vitor This time: 1. runscript applescript ``` tell application "Finder" set someSource to selection as alias list if someSource = {} then return "Select a file in Finder first" end if set theFile to item 1 of someSource as alias return quoted form of the POSIX path of theFile end tell ``` 2. utility transform ``` Transform utitliy trim space ``` 3. runscript ``` pbcopy < "${1}" ``` Error: ``` [10:24:05.982] ERROR: aa 00 copy file contents[Run Script] /Users/poudel/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/B0C62B8C-E0C6-4D51-BEB7-8BB2F90FCCB4: line 1: '/Users/poudel/tmp/try space/a.R': No such file or directory ``` Update: =========== I used another replace utitlity and replaced single quote to double quote: '/Users/poudel/tmp/try space/a.R' ==> "/Users/poudel/tmp/try space/a.R" Still, Alfred debugger says: [10:28:58.588] ERROR: aa 00 copy file contents[Run Script] /Users/poudel/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/7A7A8F20-F2F9-46BF-9D03-BCECF018944E: line 1: "/Users/poudel/tmp/try space/a.R": No such file or directory But, there is a file: /Users/poudel/tmp/try space/a.R In terminal I can type: pbcopy < "/Users/poudel/tmp/try space/a.R" This gives the string: "/Users/poudel/tmp/try space/a.R" and the command: cat "/Users/poudel/tmp/try space/a.R" | pbcopy This gives the actual contents of the file a.R in given directory. and it works in terminal.
  21. I see the problem, which is likely what was tripping up your initial code: the string is passed with a newline at the end that is being taken as being part of the name. To fix it, between the Run Scripts add a Transform Utility with Trim Whitespace.
  22. @vitor I used: javascript ``` try { decodeURI(Application('Finder').selection()[0].url()).slice(7) } catch(error) { error.message } ``` instead of applescript ``` tell application "Finder" set someSource to selection as alias list if someSource = {} then return "Select a file in Finder first" end if set theFile to item 1 of someSource as alias return quoted form of the POSIX path of theFile end tell ``` and got errror: ``` [09:56:44.050] Logging Started... [10:02:46.172] ERROR: aa 00 copy file contents[Run Script] /Users/poudel/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/3E16B543-3ADE-4963-93AE-BC34C6CF3007: line 1: /Users/poudel/tmp/try space/a.md : No such file or directory ``` still does not work with folder with spaces.
  23. You may also consider a Hotkey Trigger (set Argument to Selection in macOS). But to solve your question with a Keyword, use osascript (JS) instead of osascript (AS) and this code: try { decodeURI(Application('Finder').selection()[0].url()).slice(7) } catch(error) { error.message }
  24. @deanishe Thanks a lot for suggestion. My attempt was simpler than given link. I am interested in copy text files (.txt, .py, .md etc), images,pdf other types are not required. As vitor, suggested creating file action is super easy just pbcopy < "${1}" works good even for folder with spaces. But, I was attempting to create keyword (I already have file action) since it was easier to use and I didnt need to invoke file action trigger on selected file. I could simply use usual alfred command (double shift) as like in all other cases.
  25. @vitor Thanks for suggestion. 1. I used keyword to copy file contents of a file because its easier. using keyword: double tap shift on a file, type copy file contents, paste using file action: hit cmd \ on a file, search workflow copy file contents, select the workflow, paste using keyword saves invoking file action (cmd \) , I can directly use double shift to invoke Alfred command. 2. I appreciate pbcopy < "${1}", this is nicer than cat "$1" | pbcopy. I already have made file action for file copy, it works with space separated folders, but applescript keyword does not work.
  1. Load more activity
×
×
  • Create New...