Javascript for automation [open location in search]

I am trying to understand how JXA (JavaScript for Automation) works, so try translating a simple applet like below into JXA.

tell application "Finder"
    open location "smb://XXXXXXXX"
end tell

      

what i tried here:

finder = Application("Finder")
finder.open({location:"smb://xxxxxx"})

      

but i'm failing ... and i am new to applescript, don't quite understand the description in the library. and this is how the library describesopen

open (v) : Open the specified object(s)
open specifier : list of objects to open
  [using specifier] : the application file to open the object with
  [with properties record] : the initial values for the properties, to be included with the open command sent to the application that opens the direct object

      

please kindly advise how I change the code. ^^ Thanks

+3


source to share


1 answer


Ooh ... I have Ans ..., nothing about Application("Finder")

, this is forstandardAdditions



app = Application.currentApplication()
app.includeStandardAdditions = true
app.openLocation("smb://xxxxxxxx")

      

+6


source







All Articles