strange return characters returned from one function an not the other.

I have a string…

“acaS049_something_something.mov”

This returns the expected result…

set theFileCode to characters 1 thru 7 of theString
log "First Seven Chars:" & theFileCode

however if this is placed in a function and called passing the string as an argument I get as a result each character on a new line.

why? And how do I make it stop doing that?

on test_method(theStringArgument)
     set theFileCode to characters 1 thru 7 of theString
     return theFileCode
end test_method

The “characters of…” command actually returns a list of the characters, not a string… so you have to manually coerce it into a string. Try changing…

return theFileCode

… to …

return (theFileCode as string)

The fact that it’s returning the characters on a new line and not logging them as a list or string might indicate that you’re setting your text item delimiters to “return” somewhere in your script and not ever setting them back to the default. If so, make sure to set your delims back to {“”} when you’re done, or it can screw up a lot of other commands that you may not expect.

j