I am trying to remove 1 character from the leading string and 2 characters from the trailing string.
The information comes from the clipboard but has some characters that I want removed. The code to trim the leading character works fine but I get the following error when trying to remove the trailing 2.
error "Can’t get end of "Shrout Cemetery
"." number -1728 from last insertion point of "Shrout Cemetery
"
-- Change clipboard to text format
set the clipboard to (the clipboard as string)
-- copy clipboard to string
set the myText to the clipboard
-- trim leading character
set myText to text 2 thru end of myText as string
display dialog myText
-- trim trailing 2 characters
set myText to text 1 thru ((end of myText) - 2) as string
display dialog myText
-- put back into clipboard
set the clipboard to (myText as string)
Thanks for any suggestions
Roger