osx - Reveal In Finder Using JXA (Javascript for Automation on Mac) -


i converting of automator workflows made on years jxa , having trouble basic functions. firstly, trying open folder in finder specific path. came across this link opening location in finder, not seem work folder.

in other javascript implementations, used doing this:

var f = new file("path/to/my/file/or/folder"); f.execute(); 

it doesn't seem work in jxa. can navigate , down tree using this:

var run = function(){     var finder = application("finder");     finder.includestandardadditions = true;      return finder.startupdisk.folders["users"].open(); } 

but seems tedious , don't know how make dynamic. there way take posix path , open finder @ location?

thanks !

(function () {     'use strict';      var = application.currentapplication(),         sa = (a.includestandardadditions = true, a),         fi = application('finder');      var strpath = $('~/code/')         .stringbystandardizingpath.js      fi.reveal(path(strpath));      // or e.g.     //fi.reveal(sa.pathto('downloads folder'));      fi.activate(); })(); 

Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -