Internetizens, this little program returns the first two characters out of the file I specified.
This is surprising to me, as the source file contains a few hundred lines of text.
What am I doing wrong? Can someone wiser spot my error please? Thank you! :-D
-- This script will import to-dos and notes into Things from a plaintext file.
-- To run the script, click the green "Run" button in the toolbar above.
-- source: https://culturedcode.com/things/support/articles/2803555/#import-from-a-plain-text-file
set unixPath to "/Volumes/2_TB_SSD_external/Projects_2TB/computers-and-geekery/projects and languages/Obsidian development/wealthyvault/bin/logs/things-commit.db"
-- set text_file to (open for access (POSIX file unixPath))
set text item delimiters to tab
set database_text to (read POSIX file unixPath as «class utf8»)
set numparagraphs to (count paragraphs of database_text)
return database_text
I was able to solve my problem by changing <<utf8>>
to string
:
set database_text to (read POSIX file unixPath as «class utf8»)
became
set database_text to (read POSIX file unixPath as string)
I have no idea why, but this fixed the issue.