【问题标题】:Applescript - how to openApplescript - 如何打开
【发布时间】:2013-11-11 22:05:51
【问题描述】:

我是 Applescript 的新手,我编写了一个快速脚本,可以根据文件类型和修改日期打开一些文件/目录。任何修改后,我都需要在 iBooks 中打开这些文件。你能告诉我我的脚本有什么问题吗?

这是脚本:

set theFolder to alias "Macintosh HD:::"
tell application "iBooks"
open (file of theFolder whose name extension is "epub" and modification date is less than (current date))
end tell

【问题讨论】:

  • 您是指 iBooks Author 吗? iBooks 适用于 iOS,因此不是适用于 OSX 的应用程序。这是第一件事......
  • @CRGreen iBooks 包含在 OS X 10.9 中
  • @DigiMonk 虽然我仍然不认为它是可编写脚本的。
  • @adayzdone 是的,OS X 10.9 上的 iBooks.app 没有脚本字典。
  • 你有什么错误吗?

标签: applescript


【解决方案1】:

应该这样做:

set theFolder to POSIX file "/Users/USER/Desktop/test_folder"
set theFolder to theFolder as alias
tell application "Finder"
    open theFolder
    set myList to (every file of theFolder whose modification date is less than (current date))
    set theApp to path to application "iBooks"
    repeat with myFile in myList
        open myFile using theApp
    end repeat
end tell

因为 iBooks 不可编写脚本,所以我告诉 Finder 使用 iBooks 打开文件。同时打开所有文件时遇到了一些麻烦。这应该是可能的,但我决定使用重复循环。在本例中,假设所有文件都在用户桌面上的文件夹 test_folder 中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多