【发布时间】:2018-04-25 10:58:14
【问题描述】:
我的 AppleScript 能力相当有限,所以请原谅可能是一个简单的问题。
我将此脚本作为 Automator 服务,它将在新窗口中打开一系列别名。
由 Finder 中的键盘命令通过首选项>键盘>快捷方式>服务触发。
服务在 Finder 中接收选定的文件或文件夹
on run {input, parameters}
repeat with aFile in input
tell application "Finder"
try
set origFile to original item of aFile
set aWindow to make new Finder window
set aWindow's target to origFile's parent
select origFile
end try
end tell
end repeat
end run
我想尝试在选项卡中打开,最好不要求助于 GUI 脚本。set aWindow to make new Finder window 似乎没有等效的set aWindow to make new Finder tab 并且在 Apple 的在线文档中搜索“make”或“tab”已证明非常无果...或者说是很多水果,所有错误的品种:/
我有一个来自其他来源的 GUI 版本
on new_tab()
tell application "System Events" to tell application process "Finder"
set frontmost to true
tell front menu bar to tell menu "File" to tell menu item "New Tab"
perform action "AXPress"
end tell
end tell
end new_tab
那么,如果直接方法失败,我怎么能把它折叠到我现有的脚本中?
MacOS 10.13.4
【问题讨论】:
-
Service 的设置是什么,即 Service 在 [what] 中接收选定的 [what],以及如何Run AppleScript action 接收其
input,换句话说,它是第一个或唯一一个 action 还是什么?顺便说一句,由于您所做的研究没有提出任何非 UI 脚本 方法来打开tab,这是正确的...... AFAIK 没有办法使用 regular i> AppleScript 打开tab而不诉诸UI 脚本。另外,您运行的是哪个版本的 macOS? -
@user3439894 - 额外信息添加到问题。如果您需要更多信息,请告诉我。
标签: tabs applescript