AppleScript: Spaces in Project Names

Greetings all-
I recently cobbled together a Hazel rule with embedded AppleScript that creates new TODO items in an existing PROJECT in THINGS. However, I had to add underscores instead of spaces in the name of the PROJECT both in THINGS and in the [i]AppleScript. Arew the underscores required, or am I missing something?
Original PROJECT name was "MOVIES for MIDS" and it now reads "MOVIES_for_MIDS"
Here is my code:
I recently cobbled together a Hazel rule with embedded AppleScript that creates new TODO items in an existing PROJECT in THINGS. However, I had to add underscores instead of spaces in the name of the PROJECT both in THINGS and in the [i]AppleScript. Arew the underscores required, or am I missing something?
Original PROJECT name was "MOVIES for MIDS" and it now reads "MOVIES_for_MIDS"
Here is my code:
- Code: Select all
--code source: https://www.noodlesoft.com/forums/viewtopic.php?f=2&t=1845
set filepath to theFile as string
tell application "Finder" to set {dispName, nameExt, isHidden} to {displayed name, name extension, extension hidden} of alias filepath
if isHidden or nameExt is equal to "" then
dispName
else
(characters 1 through (-2 - (count of nameExt)) of dispName) as text
end if
set baseName to result
--code source:
tell application "Things3"
make new to do with properties {name:baseName, due date:current date} at beginning of project "MOVIES_for_MIDS"
end tell