I use @ccstoneβs excellent macro to select files in a folder in Finder.
But sometimes I then would like to inverse the selection.
Does anybody know of a way to do this in Finder?
I use @ccstoneβs excellent macro to select files in a folder in Finder.
But sometimes I then would like to inverse the selection.
Does anybody know of a way to do this in Finder?
I found this in a Google search, and it appears to work:
tell application "Finder"
set inverted to {}
set fitems to items of window 1 as alias list
set selectedItems to the selection as alias list
repeat with i in fitems
if i is not in selectedItems then
set end of inverted to i
end if
end repeat
select inverted
end tell
This is awesome. I donβt know what I need it for but I am saving it.
Thanks, Dan.
I tried with Google, but did not find what I needed.
Need to practise my Google Fu.
Itβs really interesting what you find when you test a search such as βInverse selection in Finderβ
This is what I foundβ¦
Great! I never noticed this. Thanks for finding.
This βCommand Inverting Selectionβ actually dates back to MacPaint inverting pixels when drawing with the Command key down I believe.
And it works in Keyboard Maestro too.
Hey Christian,
Iβve wanted to do this on occasion, but I canβt point to a specific use-case at the moment.
More often I want to select everything except items that contain a specific string.
In my macro that Jimmy cites above you can do some magic with a regular expression to accomplish that:
e/^(?>(?!\.mp4).)+
This will select everything but items whose name contains β.mp4β.
-Chris