Skip to content

Instantly share code, notes, and snippets.

@jbwhaley
Last active November 25, 2018 02:04
Show Gist options
  • Select an option

  • Save jbwhaley/85934b5fdc522457cf29 to your computer and use it in GitHub Desktop.

Select an option

Save jbwhaley/85934b5fdc522457cf29 to your computer and use it in GitHub Desktop.
A simple script to view all system notifications scheduled by Pythonista.
#!/usr/bin/python
# -*- coding: utf-8 -*-
# forGetter Version 1.1
## A simple script to view all system notifications scheduled by Pythonista.
## Currently running it from Launch Center Pro.
import notification
import console
import datetime
import webbrowser
# Global variables
header = "Scheduled Notifications\n"
scheduled = notification.get_scheduled()
output_list = []
url = 'launch://'
# Run the logic
if scheduled == []:
console.hud_alert('None.', 'error')
else:
for i in scheduled:
ms = i[u'message']
ts = i[u'fire_date']
ts = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')
item = ms + ":\n" + ts + "\n"
output_list.append(item)
output_string = "\n".join(output_list)
console.alert(header, output_string, 'Done?', hide_cancel_button=True)
webbrowser.open(url)
@jbwhaley

Copy link
Copy Markdown
Author

Will display a list of all currently scheduled Pythonista notifications; designed as a useful supplement to my QuickRemind script. Use with Launch Center Pro as is, or remove the last line if you prefer to run it directly in Pythonista.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment