davidrd85
-
Posts
8 -
Joined
-
Last visited
Content Type
Blogs
Gallery
Downloads
Events
Profiles
Forums
Articles
Media Demo
Posts posted by davidrd85
-
-
Just now, vitor said:
Are you sure you have installed jq? What does which jq return in a terminal?
No that is not installed.
-
14 minutes ago, vitor said:
You don’t need it. I phrased it so you can just make the text changes I pointed out. But I’ll say it another way. In all three Script Filters:
- Replace the line #!/usr/bin/env bash with export PATH="/opt/homebrew/bin:/usr/local/bin:${PATH}".
- Replace the line JSON_STRING=$(/usr/local/opt/jq/bin/jq -n \ with JSON_STRING=$(jq -n \.
This is untested, but considering your error above, should fix it.
Thank you. But that sadly did not help. I even tried a restart just to make sure.
Still same ERROR
[15:40:54.784] Logging Started... [15:40:57.189] Disk Utilities[Script Filter] Queuing argument '(null)' [15:40:57.558] Disk Utilities[Script Filter] Script with argv '(null)' finished [15:40:57.560] STDERR: Disk Utilities[Script Filter] /Users/david/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/CDCC52B7-F260-4227-B60C-275901821708: line 18: jq: command not found [15:40:57.561] Disk Utilities[Script Filter] {"items":[,]} [15:40:57.562] ERROR: Disk Utilities[Script Filter] JSON error: Invalid value around line 1, column 10. in JSON: {"items":[,]}
-
16 minutes ago, vitor said:
It is, but it installs to a different location and this Workflow hardcodes the Intel path. If you brew install jq then do the steps I wrote for @gingerbeardman above, it should work for you.
I did install Homebrew for Apple silicon. I also tried to do what you explained in your post, but I have no real scripting knowledge.
Would you please write the corrected script?
#!/usr/bin/env bash devices=($(diskutil list external physical | grep "/dev/" | cut -d' ' -f1)) for device in ${devices[@]}; do if [[ ${device} != *"disk2"* && ${device} != *"disk5"* ]];then mounted=$(mount | grep $device | wc -l) if [[ $mounted -eq 0 ]];then max_partition=$(($(diskutil list $device | wc -l)-3)) vol_name=$(diskutil info ${device}s${max_partition} | grep "Volume Name" | xargs echo -n | cut -d' ' -f3) JSON_STRING=$(/usr/local/opt/jq/bin/jq -n \ --arg title "$vol_name" \ --arg subtitle "Select to mount" \ --arg arg "$device" \ '$ARGS.named') JSON+="$JSON_STRING," fi fi done echo "{\"items\":[$JSON]}"
-
16 minutes ago, vitor said:
@davidrd85 If you are on an Intel Mac, have Homebrew, and run brew install jq in a terminal, the Workflow should start working.
@gingerbeardman To make this work out-of-the-box for more people, you only need two changes (in all Script Filters):
- Add export PATH="/opt/homebrew/bin:/usr/local/bin:${PATH}" at the top.
- Change /usr/local/opt/jq/bin/jq to jq.
Also, you can remove the #!/usr/bin/env bash shebang because it’s not doing anything; you’re already telling Alfred to run them via /bin/bash.
Thank you for the detailed explanation.
I'm on a M1 Mac though. Is Homebrew not yet available for Apple silicon?
-
On 3/6/2022 at 12:11 PM, vitor said:
Welcome @davidrd85,
Open the debugger and try again. It should tell you what’s wrong, and that’s crucial information to help you.
Thank you so much. I didn't know about that feature.
This is what I got:
[14:20:16.098] Logging Started... [14:20:20.841] Disk Utilities[Script Filter] Queuing argument '(null)' [14:20:21.230] Disk Utilities[Script Filter] Script with argv '(null)' finished [14:20:21.232] STDERR: Disk Utilities[Script Filter] /Users/david/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/E7FEF73A-A0F8-4D15-B92D-D36DADCD0903: line 18: /usr/local/opt/jq/bin/jq: No such file or directory [14:20:21.233] Disk Utilities[Script Filter] {"items":[,]} [14:20:21.234] ERROR: Disk Utilities[Script Filter] JSON error: Invalid value around line 1, column 10. in JSON: {"items":[,]}
Do I need to install some other script?
-
On 11/22/2021 at 1:45 PM, gingerbeardman said:
I updated my workflow available above.
I rewrote it in bash as I'm more familiar with that than ruby.
- mount and unmount both list Volumes by name, rather than device number
- mount will only show unmounted Volumes
- unmount will only show mounted Volumes
- vol one keyword that lists all drives available for mount/unmount- certain Volumes/Devices are skipped (hardcoded)
- no more need for list command
cheers!
Appreciate the workflow, this is just what I want.
I can not get it to work though. Every time time I try to list the volumes it just "blanks out" and shows nothing. Do you know if Apple changed something in the most resent version of Monterey?Thanks
Workflow to mount volumes
in Workflow Help & Questions
Posted · Edited by davidrd85
No clearly, but I'm a noob at this 🙄
But the workflow might be broken altogether. Now when the workflow list the unmounted disks, it just lists two selections that writes: "Not"
[16:04:03.704] Logging Started... [16:04:08.273] Disk Utilities[Script Filter] Queuing argument '(null)' [16:04:09.190] Disk Utilities[Script Filter] Script with argv '(null)' finished [16:04:09.193] Disk Utilities[Script Filter] {"items":[{ "title": "Not", "subtitle": "Select to mount", "arg": "/dev/disk4" },{ "title": "Not", "subtitle": "Select to mount", "arg": "/dev/disk6" },]}
The unmount command just fails
[16:08:02.337] Disk Utilities[Script Filter] Processing complete [16:08:02.338] Disk Utilities[Script Filter] Passing output 'Seagate' to Run Script [16:08:02.386] ERROR: Disk Utilities[Run Script] Unmount failed for Seagate
Thank you for your generous time. But this script was not really a mount/unmount solution.