1

次のことを行う Automator サービスを作成しようとしています。

  • 入力は選択されたファイルです
  • 新しいフォルダを作成し、選択したファイルをコピーします
  • HELP* 作成日時を取得し、1 分以上前に作成されたファイルを除外するための Applescript (input[contains image path] という変数がこのスクリプトに渡されます)
  • ファイル名の変更
  • ファイルのサイズ変更

ステップ 3 以外はすべて機能しています。サービスが同じフォルダーで 2 回目に実行されると、既にサイズ変更されたファイルのサイズが 2 回目に変更されるため、これは重要です。これを回避するために、40 秒/1 分以上前に作成されたものを除外する Applescript を作成したいと考えています。

これまでのところ、私はこれを持っていますが、エラーを返しています:

on run {input, parameters}


set theFileDate to (creation date of input as string)
display dialog theFileDate

return input
end run

コードが機能していることを確認し、日付/時刻の形式を確認できるように、ダイアログを表示しようとしています

4

4 に答える 4

2

作成日のプロパティにアクセスするには、Finder のスクリプト辞書を使用する必要があります。

on run {input, parameters}
    tell application "Finder"
        set theFileDate to (creation date of input as string)
    end tell
    display dialog theFileDate
    return input
end run
于 2013-07-26T19:29:44.447 に答える
0

または。

ファイルが処理されたら、ラベルのインデックスの色を設定するだけです。そして、ラベルの付いた色ではないものをフィルタリングします。

この例では、ラベル インデックスがPurpleのアイテムを除外します。

処理されたアイテムは紫に色付けされ、2 回目の実行では無視されます。

ここに画像の説明を入力

于 2013-07-27T10:33:58.950 に答える
0

これを試して。「60」を「40」またはその他の必要な秒数に変更できることに注意してください。

on run {input, parameters}
    set filterDate to (current date) - 60
    set filteredFiles to {}

    repeat with i from 1 to count of input
        set thisFile to item i of input
        if (class of thisFile) is text then set thisFile to thisFile as alias
        set creationDate to (creation date of (get info for thisFile))
        if creationDate is greater than or equal to filterDate then
            set end of filteredFiles to (item i of input)
        end if
    end repeat

    return filteredFiles
end run
于 2013-07-27T16:32:06.250 に答える