Python Forum
Using pyobjc-framework-CoreServices - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Using pyobjc-framework-CoreServices (/thread-39273.html)



Using pyobjc-framework-CoreServices - Questor24 - Jan-24-2023

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.


RE: Using pyobjc-framework-CoreServices - Questor24 - Jan-30-2023

Disappointed that no replies here or in other 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"