On 11/4/03 9:38 AM, "Remo Del Bello" <[EMAIL PROTECTED]> wrote:
> This question is for the AppleScripters on the list...
>
> I have a few AppleScripts I wrote that create message draft windows based on
> selections in dialog boxes that I make. Part of the script involves
> assigning blocks of text to variables to be used later in composing the
> draft message. For the first time since updating to Panther, I modified one
> of my scripts today, and discovered the revamped Script Editor in Panther.
> After making the modifications, I compiled and saved the script. Now when I
> run it from the Entourage script menu, all the line breaks are gone and in
> there place is some character that Entourage displays as a square!
>
> Any ideas on a work-around/fix?
Script Editor 2.0 is a Cocoa app (unlike 1.9) and so uses Linefeed (ASCII
10) line endings rather than Carriage Return (ASCII 13). That should make no
difference for executing scripts - the separate lines will be read as
separate lines. But it will affect literal text - anything with "quotes"
that you may use.
The best way around that is to never type a carriage return within quotes in
a script. Instead use the AppleScript constant 'return' which will always be
ASCII 13. Thus instead of:
set someText to "paragraph 1
paragraph2
paragraph3"
You would
set someText to "paragraph 1" & return & "paragraph 2" & return &
"paragraph 3"
In certain circumstances it might be easier for you do to this:
set someText to "paragraph 1
paragraph2
paragraph3"
set someText to my ReplaceLFWithCR(someText)
on ReplaceLFWithCR(str)
set parList to paragraphs of str -- works for LF, CR, CRLF, Unicode,
string
set AppleScript's text item delimiters to {return}
set str to to parList as Unicode text -- or 'as string'
set AppleScript's text item delimiters to {""}
return str
end ReplaceLFWithCR
This is not something Entourage can or should do for you. Other script
editors (Script Debugger, also Smile I think) lets you specify line endings.
Perhaps a later revision of Script Editor will do the same. Otherwise you
have to take care of it yourself. If Entourage were to change its own line
endings from CR to LF, it would probably break not only all previous scripts
but lots of stuff in its own code. Fortunately both Entourage and
AppleScript know what 'paragraphs' (line ends) are, no matter which version
is used. It's only in literal strings in AS, compiled in a Cocoa script
editor, where you need to take precautions.
--
Paul Berkowitz
MVP Entourage
Entourage FAQ Page: http://www.entourage.mvps.org/toc.html
PLEASE always state which version of Entourage you are using - 2001 or X.
It's often impossible to answer your questions otherwise.
--
To unsubscribe:
<mailto:[EMAIL PROTECTED]>
archives:
<http://www.mail-archive.com/entourage-talk%40lists.letterrip.com/>
old-archive:
<http://www.mail-archive.com/entourage-talk%40lists.boingo.com/>