- 投稿日 : 2009-06-29
- 更新日 : 2009-06-29
- AppleScript
ファイルリスト ( テキストファイル ) に合致するファイルに Finder でラベルを付けるアップルスクリプトのサンプルです。
set Sourcetxt to (choose file with prompt "ソーステキストファイルを指定して下さい" as string) as string
set ThisFolder to (choose folder with prompt "フォルダを選んでください")
-- ファイル読み込み
set aFilePointer to open for access alias Sourcetxt
set aData to read aFilePointer as text
close access aFilePointer
-- 配列に格納
set AppleScript's text item delimiters to return
set aList to text items of aData
set AppleScript's text item delimiters to tab
tell application "Finder"
repeat with i from 1 to count of aList
try
set theFile to ((ThisFolder as text) & (item i of aList) as text) as alias
set label index of theFile to 4
on error
log ("error" & item i of aList)
end try
end repeat
end tell
ファイルリスト ( テキストファイル ) は、文字コードが Shift-JIS で、改行コードが CR で、最終行の改行無しにしておかないと動きません。
Comments:0
Trackbacks:0
- Trackback URL for this entry
- http://bowz.info/1785/trackback
- Listed below are links to weblogs that reference
- [ AppleScript ] ファイルリストにあるファイルに Finder でラベルを付けるサンプル from Bowz::Notebook