ウクレレ日記(at)kimux.orgMacBook を Snow Leopard にしてから、ログインするとデスクトップ上のアイコンが右側にべったり並び替えられてしまう現象が。 10.6.1 へのバージョンアップで直るかと思ったらダメ。 ググってみると、3k1 さんという方が Snow Leopard:AppleScriptでデスクトップアイコンの位置を記録/再生 しているではないか。 で、記録と復元を選べるように、またキャンセルもできるように改造してみた。AppleScript なんて超、久しぶり。
property iconList : {}
property locList : {}
tell application "Finder"
set ans to display dialog "デスクトップのアイコンを?" buttons {"記録", "戻す"} default button 2
set text_ans to button returned of ans
set yes_cancel to display dialog text_ans & "ですね"
if text_ans = "記録" then
set iconList to every item of desktop
set locList to desktop position of every item of desktop
display dialog "記録しました。" buttons {"OK"} default button 1
else
if iconList = {} then
display dialog "戻したいけど記録がないよ"
else
repeat with i from 1 to (number of iconList)
try
set desktop position of item i of iconList to item i of locList
end try
end repeat
display dialog "戻しました。" buttons {"OK"} default button 1
end if
end if
end tell
| 先月 | 2010年08月 | 来月 | ||||
|---|---|---|---|---|---|---|
| 日 | 月 | 火 | 水 | 木 | 金 | 土 |
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
| 29 | 30 | 31 | ||||