Is there the possibility to ask to the webmaster to find/replace every occurrence of these encoding problems with the correct character.
It append to me that often I cannot find the correct replacement, even searching with google. And render some of the old script useless. What a waste …
I looked at the instructions extracting the body.
When the script extract the body, the result contain tags like “
” and “
”.
Assuming that they are useless for your needs, I added code to remove them.
tell application "Notes"
activate
set folderNames to name of folders
set chosenFolderNames to (choose from list folderNames with multiple selections allowed)
if (chosenFolderNames is false) then error number -128 -- Cancel button.
end tell
-- Repeat with each chosen folder name:
repeat with i from 1 to (count chosenFolderNames)
-- Get all the notes in the folder with this name.
set thisFolderName to item i of chosenFolderNames
tell application "Notes" to set theNotes to notes of folder thisFolderName
-- Repeat with each note in the folder:
repeat with thisNote in theNotes
tell application "Notes"
-- Get the relevant note data.
set myTitle to the name of thisNote
set myText to my supprime(body of thisNote, {"<div>", "</div>"})
log myText
set myCreateDate to the creation date of thisNote
set myModDate to the modification date of thisNote
set myAttachments to the attachments of thisNote
end tell
(*
-- Get alias specifiers for any attachments.
set attachmentFiles to {}
repeat with thisAttachment in myAttachments
-- Get this attachment's content identifier (cid) from Notes.
tell application "Notes" to set thisCID to content identifier of thisAttachment
-- Use it to look up the corresponding NSURL in the lookup dictionary and store the result as a file specifier.
set end of attachmentFiles to (attachmentLookup's valueForKey:(thisCID)) as alias
end repeat
*)
end repeat
end repeat
#=====
(*
removes every occurences of d in text t
*)
on supprime(t, d)
local oTIDs, l
set {oTIDs, AppleScript's text item delimiters} to {AppleScript's text item delimiters, d}
set l to text items of t
set AppleScript's text item delimiters to ""
set t to l as text
set AppleScript's text item delimiters to oTIDs
return t
end supprime
#=====
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) dimanche 17 mars 2019 15:54:24