Alan He Posted December 13, 2021 Share Posted December 13, 2021 when reveal in finder, only first file selected even though multi file selected by file action. Link to comment Share on other sites More sharing options...
vitor Posted December 13, 2021 Share Posted December 13, 2021 That’s the way macOS does it. Try it in a Terminal: open -R /some/path /another/path open -R means Reveals the file(s) in the Finder instead of opening them. (see man -P 'less --pattern "^ -R"' open). As you’ll see, even if you give multiple paths, it will only reveal one. Link to comment Share on other sites More sharing options...
Alan He Posted December 13, 2021 Author Share Posted December 13, 2021 1 hour ago, vitor said: That’s the way macOS does it. Try it in a Terminal: open -R /some/path /another/path open -R means Reveals the file(s) in the Finder instead of opening them. (see man -P 'less --pattern "^ -R"' open). As you’ll see, even if you give multiple paths, it will only reveal one. If so, I will consider whether there is a way by AppleScript. Link to comment Share on other sites More sharing options...
vitor Posted December 13, 2021 Share Posted December 13, 2021 3 hours ago, Alan He said: If so, I will consider whether there is a way by AppleScript. There is, just looked into it: Application("Finder").select( [ Path("/ONE/PATH/HERE"), Path("/ANOTHER_PATH/HERE") ] ) Link to comment Share on other sites More sharing options...
vitor Posted December 13, 2021 Share Posted December 13, 2021 Spent more time with it, and JXA suffers from a bug (I had encountered it before in the context of deleting) where one can only act on one file, multiple files, or one directory. If there is a directory in the list and one other path, it breaks. But regular AppleScript can do it: on run argv set pathList to {} repeat with pathString in argv copy ((POSIX file pathString) as alias) to the end of the pathList end repeat tell application "Finder" to select pathList end run joshuadwagner 1 Link to comment Share on other sites More sharing options...
Alan He Posted December 14, 2021 Author Share Posted December 14, 2021 (edited) 8 hours ago, vitor said: Spent more time with it, and JXA suffers from a bug (I had encountered it before in the context of deleting) where one can only act on one file, multiple files, or one directory. If there is a directory in the list and one other path, it breaks. But regular AppleScript can do it: on run argv set pathList to {} repeat with pathString in argv copy ((POSIX file pathString) as alias) to the end of the pathList end repeat tell application "Finder" to select pathList end run thank you. I found method to support diff directory. just like this. https://gist.github.com/alanhg/b6ac5adfb4c029fe44d933f998b9fbaa Edited December 14, 2021 by Alan He Link to comment Share on other sites More sharing options...
vitor Posted December 14, 2021 Share Posted December 14, 2021 I have no idea why you have such a complicated setup. The code above works fine for multiple files and directories and has no issue with unicode characters. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now