Description
Feed it a partial name (case insensitive) of an Evernote Notebook and get back the first matching notebook as an object. Originally designed as part of a command line interface for taking user input as a string parameter.The Code
(*
getNotebookFromFragment snippet by Brett Terpstra
Feed it any part of a Notebook name and get back the first matching notebook as an object
*)
on getNotebookFromFragment(fragment)
tell application "Evernote"
set NotebookList to notebooks
repeat with _notebook in NotebookList
if (offset of fragment in (name of _notebook as string)) > 0 then
return _notebook
end if
end repeat
end tell
end getNotebookFromFragment
try
tell application "Evernote" to return properties of my getNotebookFromFragment("def")
on error
return "no match"
end try
getNotebookFromFragment snippet by Brett Terpstra
Feed it any part of a Notebook name and get back the first matching notebook as an object
*)
on getNotebookFromFragment(fragment)
tell application "Evernote"
set NotebookList to notebooks
repeat with _notebook in NotebookList
if (offset of fragment in (name of _notebook as string)) > 0 then
return _notebook
end if
end repeat
end tell
end getNotebookFromFragment
try
tell application "Evernote" to return properties of my getNotebookFromFragment("def")
on error
return "no match"
end try