-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathccc_filter.scpt
37 lines (30 loc) · 999 Bytes
/
ccc_filter.scpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
set q to "{query}"
on convertListToString(theList, theDelimiter)
set AppleScript's text item delimiters to theDelimiter
set theString to theList as string
set AppleScript's text item delimiters to ""
return theString
end convertListToString
tell application "System Events"
tell application process "Amazon Chime"
set allRowNames to get name of first UI element of every row of table 1 of scroll area 1 of splitter group 1 of window "Amazon Chime"
end tell
end tell
set channels to my convertListToString(allRowNames, "
")
set fzfMatch to do shell script "echo " & quoted form of channels & "| /usr/local/bin/fzf -f " & quoted form of q
set allMatches to paragraphs of fzfMatch
set json to "{
\"items\":[
"
repeat with eachMatch in allMatches
set json to json & " {
\"title\": " & "\"" & eachMatch & "\",
" & "\"arg\": \"" & eachMatch & "\",
" & "\"icon\": {\"path\": \"chime.png\"}
},
"
end repeat
set json to text 1 thru -3 of json
set json to json & "]}"
return json