我是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
答案 0 :(得分:0)
应该这样做:
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中。