daily pastebin goal
13%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/pythonw
  2. # redundant given the python bindings but still a nice learning lesson since not much has that luxury
  3. from appscript import *
  4.  
  5. # connect to Growl
  6. growl = app('GrowlHelperApp')
  7.  
  8. # Make a list of all the notification types
  9. # that this script will ever send:
  10. allNotificationsList = ['Test Notification', 'Another Test Notification']
  11.  
  12. # Make a list of the notifications
  13. # that will be enabled by default.      
  14. # Those not enabled by default can be enabled later
  15. # in the 'Applications' tab of the growl prefpane.
  16. enabledNotificationsList = ['Test Notification']
  17.  
  18. # Register our script with growl.
  19. # You can optionally (as here) set a default icon
  20. # for this script's notifications.
  21. growl.register(
  22.     as_application='Growl Appscript Sample',
  23.     all_notifications=allNotificationsList,
  24.     default_notifications=enabledNotificationsList,
  25.     icon_of_application='PythonIDE')
  26.  
  27. # Send a Notification...
  28. growl.notify(
  29.     with_name='Test Notification',
  30.     title='Test Notification',
  31.     description='This is a test Appscript notification.',
  32.     application_name='Growl Appscript Sample')
  33.  
  34. # Another one...
  35. growl.notify(
  36.     with_name='Another Test Notification',
  37.     title='Another Test Notification :) ',
  38.     description='Alas - you won\'t see me until you enable me...',
  39.     application_name='Growl Appscript Sample')
RAW Paste Data
Top