On Sunday, November 8, 2015 at 6:00:53 AM UTC-8, Robert Livingston wrote:
I am trying to automate a task with the help of Keyboard Maestro.

I start in another program. I fill in the pieces of the Find dialogue window. 
That works fine. I can start searching and replacing in the last BBEdit 
document. So the Find dialogue "remembers that".

Now I want to start the search and replace from the start of that document.
______________________________________________________________________

Hey Robert,

It seems to me you're making this harder than it needs to be.

If I understand correctly you're wanting to do a multi-pass find/replace 
operation.

tell application "BBEdit"
  tell front text window's text
    replace "MATCH" using "REPLACE" options {search mode:grep, case 
sensitive:false, starting at top:true}
    replace "MATCH" using "REPLACE" options {search mode:grep, case 
sensitive:false, starting at top:true}
    replace "MATCH" using "REPLACE" options {search mode:grep, case 
sensitive:false, starting at top:true}
    replace "MATCH" using "REPLACE" options {search mode:grep, case 
sensitive:false, starting at top:true}
  end tell
end tell

Note that the script itself starts from the top of the document.

To simply move the cursor to the top:

tell application "BBEdit"
  tell front text window
    select insertion point before its text
  end tell
end tell

--
Best Regards,
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