I might try something like this but I don’t know if it is suitable for a distributed script. Text issues and languages other than English aren’t my strong points.
set user_ to do shell script "echo $USER"
display dialog "Hello " & (ASCII character ((ASCII number of character 1 of user_) - 32)) ¬
& text 2 thru end of user_
This is code that I’ve recently written (G&R, one guess why I wrote it):
set the_string to "\"this is a string,\" he said."
set the_string_as_title to my convert_to_title_or_sentence_case(the_string, "title")
set the_string_as_sentence to my convert_to_title_or_sentence_case(the_string, "sentence")
return the_string_as_title & return & the_string_as_sentence
on convert_to_title_or_sentence_case(the_string, the_case)
set return_string to characters of the_string
repeat with i from 1 to (length of return_string)
set the_num to ASCII number (item i of return_string)
if the_num is greater than or equal to 97 and the_num is less than or equal to 122 then exit repeat
end repeat
set item i of return_string to (ASCII character (the_num - 32))
if the_case = "title" then
try
repeat with j from (i + 1) to (length of return_string)
if item j of return_string is not in (characters of "abcdefghijklmnopqrstuvwxyz") then
set the_num to ASCII number (item (j + 1) of return_string)
if the_num is greater than or equal to 97 and the_num is less than or equal to 122 then set item (j + 1) of return_string to (ASCII character (the_num - 32))
end if
end repeat
end try
end if
return return_string as string
end convert_to_title_or_sentence_case