This is a rather small problem, but aggravating nonetheless.
The problem is with the line that begins “append” near the end of this code:
with application “Evernote”
activate
set notebook1 to notebook named “Test”
set NoteList to (title of every note in notebook1 as list)
set note1 to (create note with text (notebook notebook1 title “!CONTENTS”)
repeat with i from 1 to count items in NoteList
append note1 text (item i of NoteList as string) & return & return
end repeat
end with
(BTW, I haven’t tested this exact code, I just made most of it up on the spot to illustrate the “append” line, which I didn’t make up.)
Instead of “return & return” I could have added “\r\r”, it works the same way since “return” is the same as “\r”
This produces in note1 a list that is double-spaced. But I want the list single-spaced. However, I can’t seem to do that.
If instead of “\r\r” I put just “\r”, I get no new line at all - each item of the list follows the others on the same line. I have to add “\r\r” (or return & return) to get a new line, but then I get 2 new lines!
The same thing happens with “\n\n”.
Is this just something inherent in Evernote, or is it Applescript itself. In any case, how to fix it?
Why are you using 2 returns? The 2 returns is probably why its a double-spaced list. So try 1 return for single spaced.
In addition, you append text on every loop of the repeat loop. I would think its more efficient to create your string first and then append it once to the note. Something like this.
set NoteList to {"some", "list", "items"} --(title of every note in notebook1 as list)
set noteString to ""
repeat with i from 1 to count items in NoteList
set noteString to noteString & item i of NoteList & return
end repeat
--append noteString to end of your note here
Or you could do it this way. You could use text item delimiters to make NoteList into the string which would eliminate the repeat loop.
set NoteList to {"some", "list", "items"} --(title of every note in notebook1 as list)
set text item delimiters to return
set noteString to NoteList as text
set text item delimiters to ""
-- append noteString to end of your note here