0

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 got an error: Can’t set beginning of alias \"Macintosh HD:Users:franciscaparedes:Desktop:untitled folder:\" whose «class pMod» > date \"Monday, December 24, 2012 6:37:17 AM\" to every file of folder." number -10006 from insertion point 1 of alias "Macintosh HD:Users:franciscaparedes:Desktop:untitled folder:" whose modification date > date "Monday, December 24, 2012 6:37:17 AM"

どんな考えでもいただければ幸いです。

-エリック

4

1 に答える 1

0

これは機能します。

私はこれをざっと見ただけでした。これは、これがもっと簡単に狂う可能性が高いことを意味します。

FetchライブラリはIMOであり、十分に説明されていません。しかし、私はほとんどのアップルスクリプトライブラリのことだと思います。

しかし、あなたは図書館を読むべきです。これは、アプリケーションでスクリプト化できるものと使用する構文を理解するのに役立ちます。

アプリのライブラリにアクセスします。Applescriptエディタで。Windows->ライブラリメニューに移動します。これにより、ライブラリウィンドウが開きます。そこにアプリが表示されている場合は、ダブルクリックします。新しいライブラリが開き、使用できるすべての構文とコマンドが表示されます。

あなたがそれを見て、ああそうだと思い始めたときに興奮しないでください。これは良いことです。世界は私のものです。すぐにわかるので、すべてをまとめる方法を理解するには少し時間がかかります。

アプリがライブラリウィンドウにない場合。ファインダーでアプリを見つけてドラッグアンドドロップします。スクリプト可能である場合は、ライブラリに追加されます。

ApplesApplescriptConceptsもお読みください

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
于 2012-12-24T10:00:53.400 に答える