kearney194 0 Posted December 25, 2014 Share Posted December 25, 2014 Here is a script for a years list of notebooks and notes property theMonths : {"JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"}property theWeekdays : {"SAT", "SUN", "MON", "TUE", "WED", "THU", "FRI"} tell (current date) to set referenceDate to (it - (its day) * days + days - (its time)) set thisYear to year of referenceDate set yearList to {}repeat with i from 1 to 11set end of yearList to (thisYear + i - 6) as stringend repeat(* Fill year list with the previous 5 years followed by the next 5 *) set chosenYear to (choose from list yearList with prompt "choose a year") as stringif chosenYear is "false" then return(* set variable choosenyear to year picked from menu*)set year of referenceDate to chosenYearrepeat with aMonth from 1 to 12set month of referenceDate to aMonthset monthnotebook to text -2 thru -1 of ("0" & aMonth) & space & item aMonth of theMonthsset currentWeekDay to weekday of referenceDate as integerset dayList to {}repeat with aDay from 1 to (daysInMonth for referenceDate)set end of dayList to "/" & (text -2 thru -1 of ("0" & aDay) & "/" & chosenYear & space & "-" & space & item ((currentWeekDay mod 7) + 1) of theWeekdays)set currentWeekDay to currentWeekDay + 1set AppleScript's text item delimiters to ","end repeatrepeat with the_item in dayListtell application "Evernote"create note title (aMonth as text) & the_item with text (aMonth as text) & the_item notebook monthnotebookend tellend repeatset {TID, text item delimiters} to {text item delimiters, ","}set dayList to dayList as textset text item delimiters to TIDtell application "Evernote"if (not (notebook named monthnotebook exists)) thenmake notebook with properties {name:monthnotebook}end ifend tellend repeat on daysInMonth for theDate -- returns an integercopy theDate to dset d's day to 3232 - (d's day)end daysInMonth Link to comment
Level 5* JMichaelTX 4,118 Posted December 25, 2014 Level 5* Share Posted December 25, 2014 Thanks for sharing. This looks interesting, but I'm not sure I understand what the script produces.Could you please provide more details, and an example would be great. Link to comment
kearney194 0 Posted December 26, 2014 Author Share Posted December 26, 2014 I wanted a to create a diary folder structure. I have a folder now called 2015 and within it there are folders for each month of that year and within each of those months is a note with the date. Video below is where I got the idea. You have to create your stacks manually and I have since updated the script to include the year in the months folders to keep other years separate. For clarity I have attached a zip file with a screen shot and the video really helps. The applescript sets up folder and notes as per the second way in the video. property theMonths : {"JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"} property theWeekdays : {"SAT", "SUN", "MON", "TUE", "WED", "THU", "FRI"} tell (current date) to set referenceDate to (it - (its day) * days + days - (its time)) set thisYear to year of referenceDate set yearList to {} repeat with i from 1 to 11 set end of yearList to (thisYear + i - 6) as string end repeat (* Fill year list with the previous 5 years followed by the next 5 *) set chosenYear to (choose from list yearList with prompt "choose a year") as string if chosenYear is "false" then return (* set variable choosenyear to year picked from menu*) set year of referenceDate to chosenYear repeat with aMonth from 1 to 12 set month of referenceDate to aMonth set monthnotebook to text -2 thru -1 of ("0" & aMonth) & space & item aMonth of theMonths & space & chosenYear set currentWeekDay to weekday of referenceDate as integer set dayList to {} repeat with aDay from 1 to (daysInMonth for referenceDate) set end of dayList to "/" & (text -2 thru -1 of ("0" & aDay) & "/" & chosenYear & space & "-" & space & item ((currentWeekDay mod 7) + 1) of theWeekdays) set currentWeekDay to currentWeekDay + 1 set AppleScript's text item delimiters to "," end repeat repeat with the_item in dayList tell application "Evernote" create note title (aMonth as text) & the_item with text (aMonth as text) & the_item notebook monthnotebook end tell end repeat set {TID, text item delimiters} to {text item delimiters, ","} set dayList to dayList as text set text item delimiters to TID tell application "Evernote" if (not (notebook named monthnotebook exists)) then make notebook with properties {name:monthnotebook} end if end tell end repeat on daysInMonth for theDate -- returns an integer copy theDate to d set d's day to 32 32 - (d's day) end daysInMonth Screen shot 2014-12-25 at 10.55.55 PM.zip Link to comment
Idea
kearney194 0
Here is a script for a years list of notebooks and notes
property theMonths : {"JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC"}
property theWeekdays : {"SAT", "SUN", "MON", "TUE", "WED", "THU", "FRI"}
tell (current date) to set referenceDate to (it - (its day) * days + days - (its time))
set thisYear to year of referenceDate
set yearList to {}
repeat with i from 1 to 11
set end of yearList to (thisYear + i - 6) as string
end repeat
(* Fill year list with the previous 5 years followed by the next 5 *)
set chosenYear to (choose from list yearList with prompt "choose a year") as string
if chosenYear is "false" then return
(* set variable choosenyear to year picked from menu*)
set year of referenceDate to chosenYear
repeat with aMonth from 1 to 12
set month of referenceDate to aMonth
set monthnotebook to text -2 thru -1 of ("0" & aMonth) & space & item aMonth of theMonths
set currentWeekDay to weekday of referenceDate as integer
set dayList to {}
repeat with aDay from 1 to (daysInMonth for referenceDate)
set end of dayList to "/" & (text -2 thru -1 of ("0" & aDay) & "/" & chosenYear & space & "-" & space & item ((currentWeekDay mod 7) + 1) of theWeekdays)
set currentWeekDay to currentWeekDay + 1
set AppleScript's text item delimiters to ","
end repeat
repeat with the_item in dayList
tell application "Evernote"
create note title (aMonth as text) & the_item with text (aMonth as text) & the_item notebook monthnotebook
end tell
end repeat
set {TID, text item delimiters} to {text item delimiters, ","}
set dayList to dayList as text
set text item delimiters to TID
tell application "Evernote"
if (not (notebook named monthnotebook exists)) then
make notebook with properties {name:monthnotebook}
end if
end tell
end repeat
on daysInMonth for theDate -- returns an integer
copy theDate to d
set d's day to 32
32 - (d's day)
end daysInMonth
Link to comment
2 replies to this idea
Recommended Posts
Archived
This topic is now archived and is closed to further replies.