3

我试图弄清楚 JXA(自动化的 JavaScript)是如何工作的,所以尝试将一个简单的 applescript 如下转换为 JXA。

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

我尝试的是在这里:

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

但我失败了......,我是applescript的新手,不太了解库中的描述。这是图书馆如何描述open

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

请告知我应该如何修改代码。^^ 谢谢

4

1 回答 1

6

哦......我得到了答案......,这没什么Application("Finder"),它是为了standardAdditions

app = Application.currentApplication()
app.includeStandardAdditions = true
app.openLocation("smb://xxxxxxxx")
于 2015-01-13T07:41:51.580 回答