File tree 2 files changed +36
-1
lines changed
2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,10 @@ scripts = [
68
68
"usage": "set_accent_colour (red|orange|yellow|green|blue|purple|pink|graphite)",
69
69
"description": "set the accent colour, as configured in the Appearance settings",
70
70
},
71
+ {
72
+ "usage": "set_finder_comment PATH COMMENT",
73
+ "description": "Set the Finder comment of a file, which will be indexed by Spotlight for searching"
74
+ },
71
75
{
72
76
"usage": "sterilise [PATH]",
73
77
"description": "alias for <code>xattr -d com.apple.quarantine</code>"
@@ -208,6 +212,15 @@ cog_helpers.create_description_table(folder_name=folder_name, scripts=scripts)
208
212
set the accent colour, as configured in the Appearance settings
209
213
</dd >
210
214
215
+ <dt >
216
+ <a href="https://github.com/alexwlchan/scripts/blob/main/macos/set_finder_comment">
217
+ <code>set_finder_comment PATH COMMENT</code>
218
+ </a>
219
+ </dt >
220
+ <dd >
221
+ Set the Finder comment of a file, which will be indexed by Spotlight for searching
222
+ </dd >
223
+
211
224
<dt >
212
225
<a href="https://github.com/alexwlchan/scripts/blob/main/macos/sterilise">
213
226
<code>sterilise [PATH]</code>
@@ -238,4 +251,4 @@ cog_helpers.create_description_table(folder_name=folder_name, scripts=scripts)
238
251
</p>
239
252
</dd >
240
253
</dl >
241
- <!-- [[[end]]] (checksum: dd3558b095357994d6bd03ab9bdc8481 ) -->
254
+ <!-- [[[end]]] (checksum: d3812e637239eb78235f9823c0af4b7c ) -->
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ set -o errexit
4
+ set -o nounset
5
+
6
+ if (( $# != 2 ))
7
+ then
8
+ echo " Usage: $0 PATH COMMENT" >&2
9
+ exit 1
10
+ fi
11
+
12
+ # $ set_finder_comment src/_posts/2012/2012-12-30-hypercritical.md Hypercritical
13
+ # 2025-02-25 23:16:10.894 osascript[60436:891948] CFURLGetFSRef was passed a URL which has no scheme (the URL will not work with other CFURL routines)
14
+ FILE_PATH=" $( realpath " $1 " ) "
15
+ COMMENT=" $2 "
16
+
17
+ osascript -e '
18
+ on run argv
19
+ set filepath to (POSIX file (item 1 of argv) as alias)
20
+ tell application "Finder" to set the comment of filepath to (item 2 of argv)
21
+ end run
22
+ ' " $FILE_PATH " " $COMMENT "
You can’t perform that action at this time.
0 commit comments