開いているドキュメントを常にチェックし、閉じたときにファインダにコメントを追加するコードがあります。Applescript/Photoshop - 何らかの「ビジー状態ならば待つ」コマンドですか?
「保存しますか?」などの問題がある場合は、問題が発生しています。または "Loading ..."が表示され、0と1の間のいくつかの変わったリムボがあり、正しく数えられないようです。それは一般的な "一般的なPhotoshopエラー"メッセージでクラッシュします。
「ビジーの場合は一時停止/待機する」コマンドなどがありますか?
repeat
tell application "Adobe Photoshop CS6"
set D1 to count documents
local mainDocList
set mainDocList to {}
if ((count mainDocList) ≠ D1) then
log "Main Ran"
if (D1 > 0) then
set c to 1
repeat while (c ≤ D1)
set mainDocList to mainDocList & (file path of document c)
set c to c + 1
end repeat
end if
end if
delay 3
set D1 to count documents
local currentDocList
set currentDocList to {}
if ((count currentDocList) ≠ D1) then
log "Current Ran"
if (D1 > 0) then
set c to 1
repeat while (c ≤ D1)
set currentDocList to currentDocList & (file path of document c)
set c to c + 1
end repeat
end if
end if
end tell
local closedList, a
set closedList to {}
if ((count mainDocList) ≠ (count currentDocList)) then
repeat with a in mainDocList
set a to contents of a
if {a} is not in currentDocList then set end of closedList to a
end repeat
end if
log "∆: " & (count closedList)
log "- - - - -"
if ((count closedList) > 0 and ((count mainDocList) > (count currentDocList))) then
tell application "Finder"
set c to 1
repeat while (c ≤ (count closedList))
tell application "System Events"
set modDate to modification date of (item c of closedList)
end tell
set theDate to current date
set Y to text -2 thru -1 of ("00" & (year of theDate))
set M to text -2 thru -1 of ("00" & ((month of theDate) as integer))
set D to text -2 thru -1 of ("00" & (day of theDate))
set spartanDate to Y & M & D
set theTime to (time string of theDate)
set theTime to text -11 thru -7 of ("00" & (time string of theDate))
set currentComments to (get comment of (item c of closedList))
set comment of (item c of closedList) to currentComments & (" | USER-" & spartanDate & "-" & theTime)
log "******************COMMENTED"
set c to c + 1
end repeat
end tell
end if
end repeat
今は気が気です。なんらかの理由でtry/errorブロックを追加しても、私の頭を越えていませんでした。私はすべてのカウントブロックの周りにエラーの遅延を追加し、すべてを修正しました。 ありがとうございます! – Pixel
Pixelを歓迎します。私たちは時々助けが必要です。 –