0
我試圖找到一個腳本,當通過Hazel(在OS X上)運行時,在文件夾中查找文件類型.partial
,如果未找到,請將那個文件夾的內容是綠色的,這樣Hazel就可以用它做其他事情。如果文件類型不存在,顏色標籤爲綠色
我試圖找到一個腳本,當通過Hazel(在OS X上)運行時,在文件夾中查找文件類型.partial
,如果未找到,請將那個文件夾的內容是綠色的,這樣Hazel就可以用它做其他事情。如果文件類型不存在,顏色標籤爲綠色
運行這Applescript Editor
:
set myFolder to choose folder
tell application "Finder"
set folderContents to the entire contents of myFolder
end tell
set folderItems to the number of items in folderContents
set x to 1
repeat
set myFile to (item x of folderContents)
set theFileName to myFile as text
if (text ((offset of "." in theFileName) + 1) thru -1 of theFileName) is equal to "partial" then
return
end if
if x is equal to folderItems then exit repeat
set x to (x + 1)
end repeat
tell application "Finder"
set y to 1
repeat
set greenRepeat to item y of folderContents
set label index of greenRepeat to 6 --green
if y is equal to folderItems then exit repeat
set y to (y + 1)
end repeat
end tell
這個腳本會告訴你要選擇一個文件夾。然後它將遍歷該文件夾中的所有文件,並且如果它找不到類型爲.partial
的文件,則會將該文件夾中的所有文件變爲綠色。