Skip to content

Instantly share code, notes, and snippets.

@judismith
Created June 10, 2013 05:37
Show Gist options
  • Save judismith/5746753 to your computer and use it in GitHub Desktop.
Save judismith/5746753 to your computer and use it in GitHub Desktop.
Gets the names of folders two levels deep. Puts the names in a list with the subfolders indented. I use this to keep a handy list of all of my clients and their matter numbers. I use the names and numbers in the titles of notes pertaining to the client. When I export the EN Notes with the Evernote to Marked script, the Hazel rule watching the ex…
tell application "Finder"
set folderList to ""
set mattersFolder to (((path to home folder as text) & "Google Drive:Matters:"))
set clientFolders to get name of folders of folder mattersFolder
repeat with theFolder in clientFolders
set folderList to folderList & theFolder & return
set thePath to mattersFolder & theFolder
set subFolders to get the name of folders of folder thePath
if (count of subFolders) is greater than 0 then
repeat with aFolder in subFolders
set folderName to aFolder as text
set l to {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}
repeat with v in l
if folderName starts with v then
set folderList to folderList & tab & aFolder & return
exit repeat
end if
end repeat
end repeat
end if
end repeat
tell application "Evernote"
set matches to find notes "intitle:\"Matter List\""
if (count of matches) is 0 then
create note title "Matter List" with text folderList
else
delete item 1 of matches
create note title "Matter List" with text folderList
end if
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment