有没有办法触发Finder的“快速查看”功能带有 Applescript 的窗口?
我正在使用 Applescript 自动执行 OSX Finder 中的一些任务。该脚本打开一个文件夹并选择该文件夹中的第一个图像。我希望它也能打开“快速查看”窗口(就像用户按下空格键一样)。
我确实找到了一种使用 qlmanage,但这会弹出一个静态快速查看窗口,该窗口不再与查找器选择相关。
到目前为止的代码:
property folderPath : "/Volumes/Media/Images"
on run {}
tell application "Finder"
activate
set imageFolder to folder (folderPath as POSIX file)
set imageFile to first item of imageFolder
select imageFile
-- show quick look?
end tell
end run
I am using Applescript to automate some tasks in the OSX Finder. The script opens up a folder and selects the first image in that folder. I would like it to also bring up the "quick look" window (exactly as if the user had pressed the space bar).
I did find a way to fire up quick look from the command line using qlmanage, but that brings up a static quick look window, which is no longer tied to the finder selection.
Code so far:
property folderPath : "/Volumes/Media/Images"
on run {}
tell application "Finder"
activate
set imageFolder to folder (folderPath as POSIX file)
set imageFile to first item of imageFolder
select imageFile
-- show quick look?
end tell
end run
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您不想通过编写 Finder 脚本来完成此操作,您可以运行以下 shell 命令
在 Applescript 中,您可以执行以下操作,
具体取决于您正在执行的操作,这可能会更容易。特别是如果您主要只有一组路径。
如果您有现有的Applescript路径,您可以像这样发送它
If you don't want to do it by scripting the Finder you can run the following shell command
In an Applescript you might do this like
Depending upon what you are doing this might be much easier. Especially if you primarily just have a set of paths.
If you have an existing Applescript path you can send it like this
更新(感谢Kevin Ballard):
注意:这需要在“通用访问”控制面板中选择“启用辅助设备访问”。
Updated (with thanks to Kevin Ballard):
Note: this requires that "enable access for assistive devices" is selected in the "Universal Access" control panel.