paths in AppleScript are always colon separated HFS paths (only in do shell script arguments POSIX paths are required)
The first example works only within a Finder or System Events tell block,
but can take some time if the folder has many subfolders, so use a repeat block to wait
set selSrcFolder to path to library folder as Unicode text
tell application "Finder"
repeat until size of folder selSrcFolder is not missing value
set sourceSize to size of folder selSrcFolder
the second example works (with a HFS path), but can also return missing value, if the time to calculate the size is too long
Thanks, the delay helps not return a nul value, but I still had a problem with my path. If I substitute “path to documents folder” it all worked. So I used “POSIX file (selSourceFolder) as Unicode text” and that worked.