Skip to content

Instantly share code, notes, and snippets.

@mygeekdaddy
Created July 26, 2014 02:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mygeekdaddy/d99685a333f1f4e47b2e to your computer and use it in GitHub Desktop.
Save mygeekdaddy/d99685a333f1f4e47b2e to your computer and use it in GitHub Desktop.
startTimer.py script for WorkFlow process
# startTimer.py - writes epoch time to text file for work log
# by: Jason Verly
# rev date: 2014-07-25
import time
import console
import os
import os.path
import clipboard
import webbrowser
import urllib
if os.path.isfile('timer.txt'):
console.clear()
console.hud_alert('File exists', 'error')
webbrowser.open('drafts://')
else:
console.clear()
curDate = time.time()
f = open('timer.txt', 'w')
f.write(str(curDate))
f.close()
console.hud_alert('Timer started','success')
worklogtext = clipboard.get()
encodetxt = urllib.quote(worklogtext, safe='')
draft_url = 'drafts://x-callback-url/create?text='
action = '&action%3DWorkLog_Entry&afterSuccess%3DDelete'
webbrowser.open(draft_url + encodetxt + action)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment