Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
30 changes: 7 additions & 23 deletions Chime Channel Chooser.scpt
Original file line number Diff line number Diff line change
@@ -1,31 +1,19 @@
global fzfMatch

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

on alfred_script(q)
clickChannel(q)
clickChannel(q)
end alfred_script

on clickChannel(q)

--CONFIG:Set path for dependancy cliclick (https://www.bluem.net/en/mac/cliclick/)
set cliclickpath to "/usr/local/bin/cliclick" --<--replace null with path of cliclick i.e. "/usr/local/bin/cliclick"
--CONFIG:Set path for dependancy cliclick (https://www.bluem.net/en/mac/cliclick/)
set cliclickpath to "/usr/local/bin/cliclick"

if cliclickpath is null then
return "ERROR: cliclickpath varriable is not set"
end if
set channelLocation to getChannel(q)
set channelLocation to getChannel(q)
tell application "System Events"
tell application "Amazon Chime" to activate
tell application process "Amazon Chime"

-- From http://macscripter.net/viewtopic.php?pid=170532#p170532
perform action "AXRaise" of (first window whose name contains "Amazon Chime")
perform action "AXRaise" of (first window whose name contains "Amazon Chime")


try
Expand All @@ -50,19 +38,15 @@ on getChannel(q)
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"

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 & "|head -1"

set iterate to 1
repeat with eachRowName in allRowNames
log iterate & eachRowName
if text of eachRowName is fzfMatch then
if text of eachRowName is q then
return iterate
end if
set iterate to iterate + 1
end repeat

end tell
end tell
end getChannel
end getChannel
2 changes: 1 addition & 1 deletion ccc_filter.scpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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 fzfMatch to do shell script "echo " & quoted form of channels & "| /usr/local/bin/fzf -f " & quoted form of q & "| grep -v 'Chat Rooms\\|Recent Messages\\|Favorites'"

set allMatches to paragraphs of fzfMatch

Expand Down