I have a string that I want to use as a filename when saving a document. However, the string varies in length (up to several thousand words), so I want to cut it down to something more reasonable.
I have this, which correctly uses just the first 100 characters as the filename:
This works fine whenever myLongString is more than 100 characters long. However, it spits back an error if it is shorter. How can I save my file as "up to" the first 100 chars of myLongString?
Thanks,
CB
I have this, which correctly uses just the first 100 characters as the filename:
Code:
set myTitle to text 1 thru 100 of myLongString
make new document
set text of document 1 to otherStuff
save document 1 to "/Users/Me/Desktop/" & myTitle & ".html"
This works fine whenever myLongString is more than 100 characters long. However, it spits back an error if it is shorter. How can I save my file as "up to" the first 100 chars of myLongString?
Thanks,
CB