On 5/26/20 at 12:36 AM, hal...@frontier.com (Hal Day) wrote:

I am learning to use AppleScript for BBEdit to do find/replace editing. I find that replace does "replace all", and have not discovered how one does a single find/replace.

In general, BBEdit's AppleScript support is for intended automating text processing and other non-UI operations, and not for replicating the UI. (Some UI elements such as window shapes and ordering can be manipulated using AppleScript, but that's not its primary purpose in BBEdit.)

The operation of the "Replace" menu command thus might be modeled as:

1. Search for the desired string/pattern, specifying the text to be searched and the search options;

2. set the contents of the found range (if any) to a desired string.

The "find" event returns a result, which includes information about the matched range of text (and whether the search succeeded). You can then explicitly replace the range of text with something else, as desired.

You can get a pretty good head start on what BBEdit supports by choosing "Open Scripting Dictionary" from the Scripts menu.

R.
--
Rich Siegel                                 Bare Bones Software, Inc.
<sie...@barebones.com>                      <https://www.barebones.com/>

Someday I'll look back on all this and laugh... until they sedate me.

--
This is the BBEdit Talk public discussion group. If you have a feature request or need 
technical support, please email "supp...@barebones.com" rather than posting here. 
Follow @bbedit on Twitter: <https://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 bbedit+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/r480Ps-10146i-EF9238A34B054494A78150163A395791%40Stormwind.local.

Reply via email to