2016-05-16 5 views

答えて

1

起動サービスの設定ファイルから、デフォルトの電子メールクライアントを識別できます。

エルキャピタンでは、ファイルは~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plistにあります。 10.11より前のバージョンのシステムでは、ファイルがPreferencesフォルダに直接存在する可能性があります。

set bundleIdentifier to missing value 
set LSPrefFilePath to (path to preferences folder as text) & "com.apple.LaunchServices:com.apple.launchservices.secure.plist" 
tell application "System Events" 
    set LSPrefFile to property list file LSPrefFilePath 
    tell property list item 1 of contents of LSPrefFile 
     repeat with anItem in (get property list items) 
      if exists property list item "LSHandlerURLScheme" of anItem then 
       if value of property list item "LSHandlerURLScheme" of anItem is "mailto" then 
        set bundleIdentifier to value of property list item "LSHandlerRoleAll" of anItem 
        exit repeat 
       end if 
      end if 
     end repeat 
    end tell 
end tell 
if bundleIdentifier is missing value then 
    set defaultMailClient to "/Applications/Mail.app" 
else 
    tell application "Finder" to set defaultMailClient to POSIX path of (application file id bundleIdentifier as text) 
end if 
関連する問題