text
stringlengths
0
15.7k
source
stringlengths
6
112
repeat with i from 1 to (length of tasksSelected)
Later.applescript
tell item i of tasksSelected
Later.applescript
if startFirst then
Later.applescript
set start date of it to desiredDate1
Later.applescript
set due date of it to desiredDate2
Later.applescript
set due date of it to desiredDate1
Later.applescript
set start date of it to desiredDate2
Later.applescript
else if ((methodForScheduling is "Start") and not escapeToDue) or escapeToStart then
Later.applescript
if usesFlagsForScheduling then set its flagged to true
Later.applescript
on englishTime(dateDesired)
Later.applescript
if dateDesired is "0" then return 0
Later.applescript
set monthFound to 0
Later.applescript
set weekdayFound to 0
Later.applescript
set minuteLeadingZero to false
Later.applescript
set timeMissing to false
Later.applescript
set daysMissing to false
Later.applescript
set weeksMissing to false
Later.applescript
set timeDelimiters to {"am", "pm", "a", "p", ":"}
Later.applescript
set dayDelimiters to {"days", "day", "d"}
Later.applescript
set weekDelimiters to {"weeks", "week", "w"}
Later.applescript
set monthDelimiters to {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}
Later.applescript
set weekdayDelimiters to {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}
Later.applescript
set specialRelativeDayDelimiters to {"Today", "Tomorrow", "at"}
Later.applescript
set otherDelimiters to {" ", "th", "st", "rd", "nd", "start", "due", "both"}
Later.applescript
set inThe to "unknown"
Later.applescript
set howManyNumbersInputted to 0
Later.applescript
set numList to {}
Later.applescript
if isNumberIdentifier("a", dateDesired) then set inThe to "AM"
Later.applescript
if isNumberIdentifier("p", dateDesired) then set inThe to "PM"
Later.applescript
set my text item delimiters to specialRelativeDayDelimiters & otherDelimiters & timeDelimiters
Later.applescript
set checkInput to every text item of dateDesired
Later.applescript
set checkInputCleaned to {}
Later.applescript
repeat with i from 1 to (length of checkInput)
Later.applescript
if item i of checkInput is not "" then
Later.applescript
set the end of checkInputCleaned to item i of checkInput
Later.applescript
set theDateCheck to item 1 of checkInputCleaned
Later.applescript
if (theDateCheck contains ".") or (theDateCheck contains "-") or (theDateCheck contains "/") then
Later.applescript
set todaysDate to (current date)
Later.applescript
set time of todaysDate to 0
Later.applescript
set targetDate to my understandAbsoluteDate(theDateCheck)
Later.applescript
if targetDate = -1 then return -1
Later.applescript
if length of checkInputCleaned is 1 then
Later.applescript
return (targetDate - todaysDate) as number
Later.applescript
set theTime to items 2 thru -1 of checkInputCleaned
Later.applescript
set timeStoreLocation to length of theTime
Later.applescript
repeat while timeStoreLocation > 0
Later.applescript
if (numList = {}) and ((item timeStoreLocation of theTime) starts with "0") then
Later.applescript
set the end of numList to ((item (timeStoreLocation - 1) of theTime) & (item timeStoreLocation of theTime)) as number
Later.applescript
set minuteLeadingZero to true
Later.applescript
set timeStoreLocation to timeStoreLocation - 2
Later.applescript
set tempNum to (item timeStoreLocation of theTime) as number
Later.applescript
if tempNum ≠ 0 then set the end of numList to tempNum
Later.applescript
set timeStoreLocation to timeStoreLocation - 1
Later.applescript
set theTime to figureOutTheTime(numList, false, true, true, minuteLeadingZero)
Later.applescript
set theTime to understandTheTime(theTime, inThe, false)
Later.applescript
return (targetDate + theTime - todaysDate) as number
Later.applescript
repeat with i from 1 to (length of monthDelimiters)
Later.applescript
if dateDesired contains (item i of monthDelimiters) then
Later.applescript
set monthFound to i
Later.applescript
if i ≤ (length of weekdayDelimiters) then
Later.applescript
if dateDesired contains (item i of weekdayDelimiters) then
Later.applescript
set weekdayFound to i
Later.applescript
set text item delimiters to (specialRelativeDayDelimiters & monthDelimiters & weekDelimiters & dayDelimiters & timeDelimiters & otherDelimiters)
Later.applescript
set inputList to every text item of dateDesired
Later.applescript
set text item delimiters to {""}
Later.applescript
repeat with i from 1 to (length of inputList)
Later.applescript
if item i of inputList is "-" and (character 1 of item (i + 1) of inputList is in "123456789") then
Later.applescript
set item (i + 1) of inputList to item i of inputList & item (i + 1) of inputList
Later.applescript
if (item i of inputList) is not "" then
Later.applescript
set tempItem to (item i of inputList) as integer
Later.applescript
if class of tempItem is integer then set howManyNumbersInputted to howManyNumbersInputted + 1
Later.applescript
set tempItem to ""
Later.applescript
set timeStoreLocation to length of inputList
Later.applescript
if (numList = {}) and ((item timeStoreLocation of inputList) starts with "0") then
Later.applescript
set the end of numList to ((item (timeStoreLocation - 1) of inputList) & (item timeStoreLocation of inputList)) as number
Later.applescript
set tempNum to (item timeStoreLocation of inputList) as number
Later.applescript
set numList to reverse of numList
Later.applescript
if (monthFound is 0) and (weekdayFound is 0) then
Later.applescript
tell dateDesired
Later.applescript
set daysMissing to not my isNumberIdentifier("d", it)
Later.applescript
set weeksMissing to not my isNumberIdentifier("w", it)
Later.applescript
if (howManyNumbersInputted - ((not daysMissing) as integer) - ((not weeksMissing) as integer)) = 0 then set timeMissing to true
Later.applescript
if not weeksMissing then
Later.applescript
set weeksDeferred to item 1 of numList
Later.applescript
set weeksDeferred to 0
Later.applescript
if not daysMissing then
Later.applescript
set daysDeferred to howManyDays(numList, weeksMissing)
Later.applescript
if dateDesired contains "Tomorrow" then
Later.applescript
set daysDeferred to 1
Later.applescript
set daysDeferred to 0
Later.applescript
set timeDeferredTemp to figureOutTheTime(numList, timeMissing, daysMissing, weeksMissing, minuteLeadingZero)
Later.applescript
set timeDeferred to understandTheTime(timeDeferredTemp, inThe, timeMissing)
Later.applescript
if timeDeferred ≥ 0 then
Later.applescript
set totalTimeDeferred to timeDeferred + daysDeferred * days + weeksDeferred * weeks
Later.applescript
set totalTimeDeferred to timeDeferred
Later.applescript
else if (weekdayFound > 0) and (monthFound is 0) then
Later.applescript
if length of numList < 1 then set timeMissing to true
Later.applescript
set timeDeferredTemp to figureOutTheTime(numList, timeMissing, true, true, minuteLeadingZero)
Later.applescript
set daysDeferred to daysFromTodayToWeekday(weekdayFound)
Later.applescript
set totalTimeDeferred to daysDeferred * days + timeDeferred
Later.applescript