Description
This will present a user with a dialog box which allows them to type in their tags. The tags can be separated by commas or colons and then can be passed through to another subroutine to make an item list out of the typed text. With a list like this, you can then use a "tag checker" handler to see if the tag already exists and, if it doesn't, create it. I use this tagging dialog for "batch tagging" scripts. I prefer to use a dialog that lets me also work with notebooks when I'm writing a script to do imports.The Code
--TAG USER DIALOG
on evernote_Tag_Dialog()
set default_Tag to "${Default Tag Name:The Tag}"
set dialog_Title to "${The Title Of This Dialog Box:The Title}"
set EVnotebook to ""
display dialog "" & ¬
"Tags to Add " & return & "(Separated By Commas or Colons)" with title dialog_Title default answer default_Tag buttons {"Add Tags", "Cancel"} default button "Add Tags" cancel button ¬
"Cancel" with icon path to resource "Evernote.icns" in bundle (path to application "Evernote")
set dialogResult to the result
set userInput to text returned of dialogResult
set ButtonSel to button returned of dialogResult
set theDelims to {":", ","}
set EVTag to my Tag_List(userInput, theDelims)
end evernote_Tag_Dialog
on evernote_Tag_Dialog()
set default_Tag to "${Default Tag Name:The Tag}"
set dialog_Title to "${The Title Of This Dialog Box:The Title}"
set EVnotebook to ""
display dialog "" & ¬
"Tags to Add " & return & "(Separated By Commas or Colons)" with title dialog_Title default answer default_Tag buttons {"Add Tags", "Cancel"} default button "Add Tags" cancel button ¬
"Cancel" with icon path to resource "Evernote.icns" in bundle (path to application "Evernote")
set dialogResult to the result
set userInput to text returned of dialogResult
set ButtonSel to button returned of dialogResult
set theDelims to {":", ","}
set EVTag to my Tag_List(userInput, theDelims)
end evernote_Tag_Dialog