I've solved the problem but realize now my description of my objective
wasn't sufficiently clear. Here's the problem and how it was solved.

I'm using an AppleScript to search and replace elements of an HTML file in
BBEdit, effectively to standardize a set of files. However, to make the
final file more readable by humans, I'd like to include an actual line
return between a sequence such as "some script stuff</script></head>" so
that the result looks like this:

some script stuff</script>
</head> -- figuring that if the </head> tag is flush left then the end point
of the head section will be more noticeable.

I found that simply entering a return at that point in the AppleScript
didn't do the trick. Yes, it created a line return in the AppleScript itself
but when it was run on the HTML file in BBEdit no line return was entered,
was still a continuous string.

I played around with entering \\r and \r into the AppleScript and that had
the same result, produced some oddities but no line return inserted into the
HTML.

Finally someone elsewhere brought to my attention that the term "return" is
available syntax in AppleScript. Here's what I then entered in AppleScript:

"some script stuff</script>" & return & "</head>"

Inserted this code into the search and replace routine, compiled it and then
run it against an HTML file and voila, I get:

some script stuff</script>
</head>

It works.

on 2/20/08 6:21 PM, John Delacour at [EMAIL PROTECTED] wrote:

> At 07:43 -0500 18/2/08, Morley Chalmers wrote:
> 
>> ...Since posting my issue someone suggested adding just \r to the
>> script. However, all that does is cause a line return to the script
>> itself when the script is compiled. When the script is run on the
>> BBEdit file a vertical rectangular box in inserted at that location,
>> NOT an actual line return. Undoubtedly that's an unknown ASCII
>> character. I had earlier found this to be the case by manually
>> adding a line return into the AppleScript.
> 
> I can't reproduce your problem using either Script Editor or Smile,
> but it may be that your set-up creates an incompatibility.  I guess
> you may have BBEdit set to use Mac line endings and are using Script
> Editor, which uses UNIX linefeeds.
> 
> I'd suggest you set your preferences (and existing documents) to use
> UNIX line feeds and encodeing utf-8.
> 
> Here's an example of a script that works fine from either Smile or
> Script Editor:
> 
> tell application "BBEdit"
>    set w to make window with properties {text:"</script></head>"}
>    tell w
>      replace "</script></head>" using "</script>
> </head>" options {starting at top:true}
>    end tell
> end tell
> 
> JD

Morley Chalmers
--
Do not worry if you have built your castles in the air. They are where they
should be. Now put the foundations under them. -- Henry David Thoreau



-- 
------------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_script.shtml>
List archives: <http://www.listsearch.com/bbeditscripting.lasso>
To unsubscribe, send mail to:  <[EMAIL PROTECTED]>

Reply via email to