自动化的javascript [在finder中打开位置] [英] javascript for automation [open location in finder]

查看:105
本文介绍了自动化的javascript [在finder中打开位置]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试弄清JXA(自动化JavaScript)的工作原理,因此请尝试将以下简单的applescript转换为JXA.

I am trying to figure out how JXA(JavaScript for Automation) works, so try to translate a simple applescript as below to JXA.

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

我尝试过的是这里

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

但是我失败了,而且我是applescript的新手,不是很了解图书馆中的描述. 这是库描述open

but I fail..., and I am new to applescript, not really understand the description in library. and here is how the library describe the 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

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

please kindly advise how should I amend the code. ^^ Thanks

推荐答案

哦...我得到了Ans ...,与Application("Finder")无关,它与standardAdditions

Oh ... I got the Ans..., it's nothing about Application("Finder"), it is for standardAdditions

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

这篇关于自动化的javascript [在finder中打开位置]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆