Skip to main content
Solved

Using pyobjc-framework-CoreServices

  • January 23, 2023
  • 1 reply
  • 1 view

Forum|alt.badge.img+9

Trying to write a replacement for SetDefaultMailApp which implies LaunchServices but seems to be part of CoreServices now and I've installed the python module but have no idea how to import it so I can use LSSetDefaultHandlerForURLScheme

Thanks for any Python 3.11 help.

Best answer by mfcfadmin

Disappointed that no replies here or in Python forums so went with AppleScript application:


-- defaults write as an application to set mailto handler to Outlook

-- plist is under ~/Library/Preferences/

-- osascript -e 'id of app "Microsoft Outlook"'

-- will give you the com.microsoft.Outlook

do shell script "defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers -array-add '{\\"LSHandlerPreferredVersions\\" = { \\"LSHandlerRoleAll\\" = \\"-\\"; };LSHandlerURLScheme=mailto;LSHandlerRoleAll=com.microsoft.Outlook;}'"

display dialog "Reboot required to take effect" buttons {"OK"} default button "OK"


 

View original
Did this topic help you find an answer to your question?

1 reply

Forum|alt.badge.img+9
  • Author
  • Contributor
  • 80 replies
  • Answer
  • January 30, 2023

Disappointed that no replies here or in Python forums so went with AppleScript application:


-- defaults write as an application to set mailto handler to Outlook

-- plist is under ~/Library/Preferences/

-- osascript -e 'id of app "Microsoft Outlook"'

-- will give you the com.microsoft.Outlook

do shell script "defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers -array-add '{\\"LSHandlerPreferredVersions\\" = { \\"LSHandlerRoleAll\\" = \\"-\\"; };LSHandlerURLScheme=mailto;LSHandlerRoleAll=com.microsoft.Outlook;}'"

display dialog "Reboot required to take effect" buttons {"OK"} default button "OK"


 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings