I am converting some of the automator workflows I made over the years into JXA and I am having some trouble with some basic functions. Firstly, I am simply trying to open a folder in finder from a specific path. I came across this link for opening a location in finder, but it does not seem to work for a folder.
In other Javascript implementations, I am used to doing something like this:
var f = new File("path/to/my/file/or/folder");
f.execute();
it doesn't seem to work in JXA. I can navigate up and down a tree using something like this:
var run = function(){
var finder = Application("Finder");
finder.includeStandardAdditions = true;
return finder.startupDisk.folders["Users"].open();
}
But that seems very tedious and I don't know how to make it dynamic. Is there a way to take a POSIX path and open finder at that location?
Thanks for all the help !