Text error help please.

I’m setting a variable to a specific value. Because I want to get rid of the filetype at the end of that value (.aiff), I use the following code to change the final destination of the file:

set new_nam to characters 1 thru -5 of new_nam as string
set sav_dir to "Darwin:Users:dakota:Desktop:"
set sav_nam to sav_dir & new_nam

When I step through the script it looks OK. But when I put together this save file + a new file designation the value now has spaces between all of the characters. For example:

Any way to fix this? What am I doing wrong here?

SA :smiley:

Somewhere along the line, your script’s or your script editor’s text item delimiters have become set to a space. Resetting them to an empty string should solve the problem:

set AppleScript's text item delimiters to {""}

But don’t use ‘characters … as string’. That’s wasteful. Use ‘text …’:

set new_nam to text 1 thru -5 of new_nam