ドライブのマウントを検出してsayコマンドで通知するAppleScriptです。
AppleScript名:ドライブマウント検出 |
— Created 2016-10-27 by Takaaki Naganoya — 2016 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" use framework "AppKit" on run current application’s NSWorkspace’s sharedWorkspace()’s notificationCenter()’s addObserver:me selector:"onVolumeMount:" |name|:"NSWorkspaceDidMountNotification" object:(missing value) current application’s NSWorkspace’s sharedWorkspace()’s notificationCenter()’s addObserver:me selector:"onVolumeUnmount:" |name|:"NSWorkspaceDidUnmountNotification" object:(missing value) end run on onVolumeMount:aNotif say "マウントしました" using "Kyoko" –Mount Message In Japanese end onVolumeMount: on onVolumeUnmount:aNotif say "アンマウントしました" using "Kyoko" –Unmount Message In Japanese end onVolumeUnmount: |
More from my site
(Visited 63 times, 1 visits today)