On Nov 12, 2015, at 11:05, TJ Luoma <[email protected]> wrote:
> Or you can go pure AppleScript which will not affect the selection.
> 
> tell application "BBEdit"
>   tell front text document
>     tell its text to replace "[[:blank:]]+$" using "" options {search 
> mode:grep, starting at top:true}
>     if its on disk = true then save it
>   end tell
> end tell
> 
> Whenever I used that, the trailing spaces were removed, but the document 
> ended up unsaved… and empty. Not sure why.

______________________________________________________________________

Hey TJ,

Eh?

Are you saying the content was deleted?

The document should only save if it has been saved to disk once already, which 
lets you operate on documents you don't want to save.

What version of BBEdit?  What OSX?

You ran the script from where?  Oh – if you ran it via osascript from a text 
filter then of course it didn't work.

It should be saved as a compiled AppleScript using the Script Editor.app and 
run from BBEdit's Script menu.

--
Take Care,
Chris

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].

Reply via email to