Class: CreateTask::DueApp

Inherits:
Helper
  • Object
show all
Defined in:
lib/create_task/due_app.rb

Overview

Creates a task in Due App

Class Method Summary collapse

Methods inherited from Helper

#default_parsed_date, new_task, #parse_date

Class Method Details

.create(args) ⇒ Object

include ‘helper’



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/create_task/due_app.rb', line 6

def self.create(args)
  name = args[:name]
  due_date = args[:due_date]
  `osascript << 'APPLESCRIPT'
     set d_date to date "#{due_date}"
     set theURl to "due:///add?title=#{name}&due_date=" & d_date
     tell application "Finder" to open location theURl
     tell application "Due" to activate
     delay 0.5 -- This delay can be tweaked for your system
     tell application "Due" to activate
     tell application "System Events" to key code 36
     delay 1 -- This delay can be tweaked for your system
     APPLESCRIPT`
end