I neglected to include the one other Dropbox requirement: trimming trailing spaces in the basename.
I was also thinking that perhaps the conversion should be more finely parsed to reflect how characters are typically (?) used in filenames – something like:
on processName(_name)
[INDENT]set _invalidChars to “<>//\|”
repeat with _c in _invalidChars
[INDENT]set _name to my replace(_name, _c, “-”)
end repeat
set _invalidChars to “”?*"
repeat with _c in _invalidChars
set _name to my replace(_name, _c, " “)
end repeat
set _invalidChars to “:”
repeat with _c in _invalidChars
set _name to my replace(_name, _c, " -”)
end repeat
return _name[/INDENT]
end processName[/INDENT]
AFAIR, within basenames, a space is a good-enough substitute for most double quotes, question marks, and asterisks. But as backslash, forward slash, and vert bar are only used as separators, a hyphen is better than a space for readability (IMO). I preceded the colon with a space to match the space that generally follows within basenames.
Thoughts about including the above in your script?