Evernote Notebook Selection Subroutine — Japanese

Description

This is the Japanese translation of this subroutine: It will present a dialog box that allows you to pick which Evernote notebook to use within a script (in alphabetical order thanks to the simple sort subroutine that I've also included in this subroutine). In my own scripts, I use this to pick the notebook where I want to send items to... or to select notebook that I want to *do something* to. Note: Due to the peculiarities of AppleScript's "choose from list" function which only allows two buttons, the "New Notebook" button takes the place of the "Cancel" button. If a user wants to cancel the selection, they need to select "New Notebook" First and then cancel from the "New Notebook" dialog box. I am open to revisions that make this easier for users so, if you can demonstrate a better way to do this, I would be very grateful!

The Code

--EVERNOTE NOTEBOOK SELECTION SUBROUTINE
on Notebook_List()
    tell application "Evernote"
        activate
        set listOfNotebooks to {} (*PREPARE TO GET EVERNOTE'S LIST OF NOTEBOOKS *)
        set EVNotebooks to every notebook (*GET THE NOTEBOOK LIST *)
        repeat with currentNotebook in EVNotebooks
            set currentNotebookName to (the name of currentNotebook)
            copy currentNotebookName to the end of listOfNotebooks
        end repeat
        set Folders_sorted to my simple_sort(listOfNotebooks) (*SORT THE LIST *)
        set SelNotebook to choose from list of Folders_sorted with title "Evernote のノートブックを選択" with prompt ¬
            "現在の Evernote ノートブック" OK button name "OK" cancel button name "新規ノートブック" (*USER SELECTION FROM NOTEBOOK LIST *)
        if (SelNotebook is false) then (*CREATE NEW NOTEBOOK OPTION *)
            set userInput to ¬
                text returned of (display dialog "新規ノートブック名を入力:" default answer "")
            set EVnotebook to userInput
        else
            set EVnotebook to item 1 of SelNotebook
        end if
    end tell
end Notebook_List

--SORT SUBROUTINE
on simple_sort(my_list)
    set the index_list to {}
    set the sorted_list to {}
    repeat (the number of items in my_list) times
        set the low_item to ""
        repeat with i from 1 to (number of items in my_list)
            if i is not in the index_list then
                set this_item to item i of my_list as text
                if the low_item is "" then
                    set the low_item to this_item
                    set the low_item_index to i
                else if this_item comes before the low_item then
                    set the low_item to this_item
                    set the low_item_index to i
                end if
            end if
        end repeat
        set the end of sorted_list to the low_item
        set the end of the index_list to the low_item_index
    end repeat
    return the sorted_list
end simple_sort