applescript和Fetch

applescript和Fetch,applescript,Applescript,我打算使用Automator运行一些远程到本地的备份,但需要执行一些循环,所以我认为Applescript是一个更好的选择。作为Applescript的新手,我第一次尝试从具有特定特征的给定文件夹下载所有文件时出现了一个错误: set today to current date set yesterday to (today - 1) tell application "Fetch" activate open remote folder "/public_html/books/

我打算使用Automator运行一些远程到本地的备份,但需要执行一些循环,所以我认为Applescript是一个更好的选择。作为Applescript的新手,我第一次尝试从具有特定特征的给定文件夹下载所有文件时出现了一个错误:

set today to current date
set yesterday to (today - 1)
tell application "Fetch"
    activate
    open remote folder "/public_html/books/book_3/_thumbs/Images"
    copy every file of folder to beginning of alias "MacintoshHD:Users:franciscaparedes:Desktop:untitled folder:"
whose modification date is greater than yesterday
end tell
这是我的错误:
Fetch出现错误:无法将别名“Macintosh HD:Users:Franciscapades:Desktop:untitled folder:”的开头设置为文件夹的每个文件的“日期”。别名“Macintosh HD:Users:Franciscapades:Desktop:untitled folder:“其修改日期>日期”2012年12月24日星期一上午6:37:17“

如有任何想法,将不胜感激

-埃里克

这很管用

我只是快速看了一下这个。这意味着这很有可能是更简单的

Fetch库没有得到很好的解释。但我认为大多数applescript库都是如此

但是你应该读图书馆。这将帮助您了解应用程序中哪些内容是可编写脚本的,以及要使用的语法

访问应用程序库。在Applescript编辑器中。转到Windows->library菜单。 这将打开“库”窗口。如果你在那里看到你的应用程序,双击它。将打开一个新库,其中包含您可以使用的所有语法和命令

当你看到它时,不要激动,开始想哦,是的,宝贝,这很好,世界是我的..哈哈哈。因为你很快就会发现,要锻炼如何将所有这些结合起来需要一点时间

如果应用程序不在库窗口中。在finder中找到应用程序并将其拖放到其中。如果可以编写脚本,则会将其添加到库中

也读


谢谢@markhunte。这真的帮助我走上了正确的道路!没问题。这是否回答了你的问题,还是还有更多?
set today to current date
set number_of_days to 1

tell application "Fetch"
    activate

    #open a shortcut
    open shortcut "Shortcut Name"
    #set the remote window to your remote path
    open remote folder "/public_html/books/book_3/_thumbs/Images"

    #get the properties of every file in remote window. This will give use the modified date and url of each file
    set props to properties of remote items of transfer window 1

    #iterate through the files
    repeat with i from 1 to number of items in props
        # one of the items
        set this_item to item i of props
        #get its modification date
        set modDate to modification date of this_item
        # compare the dtae by using number of days
        set TimeDiff to (today - modDate) -- the difference in seconds
        set DaysOut to (TimeDiff div days) -- the number of days out

        if DaysOut is greater than number_of_days then
            #use the files url to download it to the POSIX file path of you folder
            download url (url of this_item) to file "MacintoshHD:Users:franciscaparedes:Desktop:untitled folder:"
        end if

    end repeat

end tell