• Apfeltalk ändert einen Teil seiner Allgemeinen Geschäftsbedingungen (AGB), das Löschen von Useraccounts betreffend.
    Näheres könnt Ihr hier nachlesen: AGB-Änderung
  • Der Frühling ist auch in den eingesandten Fotos deutlich zu erkennen. Zeigt uns, wer Euer Favorit ist! hier geht es lang für Euer Voting --> Klick

Ordneraktion - Fehler im Script

da_FloZinger

Erdapfel
Registriert
12.09.15
Beiträge
2
Hi zusammen,

ich versuche mich gerade ein bisschen an Applescript und würde mir gerne ein Script als Ordneraktion basteln, welches eingescannte Dokumente in Evernote importiert.

Mein Script sieht derzeit so aus:

Code:
on adding folder items to this_folder after receiving added_items
    repeat with i from 1 to number of items in added_items
        set new_item to item i of added_items
      
        delay 3
        display dialog "Notiztitel eigenben:" with title "Evernote Importer Script" default answer "" buttons {"Weiter", "Abbrechen"} default button 1 with icon path to resource "Evernote.icns" in bundle (path to application "Evernote")
        set Notiztitel to text returned of the result
      
        tell application "Evernote"
            activate
            # Notizbücher abfragen
            set listOfNotebooks to {}
            set EVNotebooks to every notebook
            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)
            #Notizbücher anzeigen und auswählen
            set SelNotebook to choose from list of Folders_sorted with title "Evernote Notizbuch auswählen" with prompt ¬
                "Verfügbare Notizbücher:" OK button name "Weiter..." cancel button name "Abbrechen"
            set Notizbuch to item 1 of SelNotebook
          
            # Notiz erstellen  
            create note from file new_item title Notiztitel notebook Notizbuch # tags "TEST"
          
        end tell
    end repeat
end adding folder items to


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

Es läuft soweit auch. Ich kann den Notiztitel eingeben und das Notizbuch auswählen. Aber dann passiert weiter nix.

Könntet ihr mir da vielleicht weiterhelfen?
Vielen Dank


Gruß
Flo