-1
所以我對AppleScript很新穎,但我正在嘗試製作一個腳本來對我的視頻文件進行排序。AppleScript:Finder Sorting
我看起來似乎無法解決這個問題。什麼都沒發生。任何人都有線索?
一個可能的解釋可能是文件夾是我的家庭服務器,而不是在硬盤上?
property nameList : {"Arrow"} -- the start of the fileName to check
property destFoldersPath : {"/Volumes/media/Videos/Serier/Arrow"} -- drag/drop the dest folder in each item of this list
on adding folder items to masterFolder after receiving these_items
repeat with tFile in these_items
set destFolder to my check_start_of_Name(tFile as string)
if destFolder is not "" then -- this file name is in the first list
tell application "Finder" to move tFile to destFolder with replacing --move this file
end if
end repeat
end adding folder items to
on check_start_of_Name(t)
set tc to count nameList
repeat with i from 1 to tc
if t starts with (item i of nameList) then
set seasonPath to my check_season_of_Name(t)
set outputPath to (POSIX file (item i of destFoldersPath))
set completePath to outputPath & seasonPath as alias
if FinderItemNotExists(completePath) then
tell application "Finder"
make new folder at outputPath with properties {name:seasonPath}
end tell
end if
log outputPath
return outputPath as alias -- return the dest folder
end if
end repeat
return "" -- this name is not in the list
end check_start_of_Name
on check_season_of_Name(t)
repeat with s from 1 to 30
set SW to s
if s is less than 10 then set SW to "0" & s
set seasonName to "Season " & SW
log seasonName
if seasonName is in t then
return seasonName
end if
end repeat
end check_season_of_Name
on FinderItemNotExists(thePath)
try
set thePath to thePath as alias
on error
return true
end try
return false
end FinderItemNotExists
有太多的「噪音」,這使得它很難理解的問題;嘗試縮小問題範圍並描述特定症狀。 – mklement0