Handler return

I am having trouble getting the return to work in a handler. The display dialog just before the return shows the correct results but the display dialog following the call to the handler shows the original value s.

This must be simple but I can just not find the answer and any suggestions or help would be appreciated.

Roger



set s to "cat"

upperCase(s)

display dialog s


on upperCase(s)
	set uc to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	set lc to "abcdefghijklmnopqrstuvwxyz"
	repeat with i from 1 to 26
		set AppleScript's text item delimiters to character i of lc
		set s to text items of s
		set AppleScript's text item delimiters to character i of uc
		set s to s as text
	end repeat
	set AppleScript's text item delimiters to ""
	display dialog s & "   1"
	return s
end upperCase

Hello.

Try:


set s to upperCase(s)

The problem was that you didn’t read the return value, this is not an error when you don’t need the return value. To avoid the return value you could have passed the variable as a reference, using a reference to, but then you would have had to declare your variable as a property. But then you would have to pull the value out of s inside your handler using contents of.

And by the way, your script won’t work that well on my machine, as it is a command in Satimage.Osax with the same name, I suggest you change to upper, or capitals, or something.

Thanks I knew it must be simpel but

Roger