The Applescript below looks at the front open finder window, finds the file type of a file that is selected, and then highlights all files of that file type. I.e., if a finder window has a mix of .jpg, .png and .webp files, the script finds the one file that is selected (such as a .jpg) and then selects all .jpg files.
try
tell application "Finder" to set the source_folder ¬
to (folder of the front window) as alias
on error -- no open folder windows
--set the source_folder to path to desktop folder as alias
--problem is a window can be open but out of focus
beep
end try
tell application "Finder"
set selectionList to {} & selection as list
set selectedCount to count items in selectionList
if selectedCount > 0 then
set nameExtension to name extension of item 1 in selectionList
select (every item where name extension ¬
is nameExtension) of (folder source_folder)
end if
end tell
How would I modify this so it works with an application like the FTP client Transmit? Transmit is Applescript aware and appears in the Applescript Dictionary.
Of course, simply changing tell application "Finder"
to tell application "Transmit"
doesn't work, since source_folder
throws an error as it's looking for a finder window and not an application window.
selection
terminology. – red_menace Sep 12 '19 at 19:35