I have a BBEdit document looking something like this:
{Tag_A}
Some text, could be multiple sentences, multiple paragraphs.
{/Tag_A}
Some other text here
{Tag_B}
More text here. Could be multiple sentences, multiple paragraphs, as above.
{/Tag_B}
{Tag_A}
Some text, could be multiple sentences, multiple paragraphs.
{/Tag_A}
Some other text here
{Tag_B}
More text here. Could be multiple sentences, multiple paragraphs, as above.
{/Tag_B}
Etc.
I have two AppleScripts which currently work on whatever text it selected. For
purposes of this discussion let's say I have Script A which applies some custom
capitalization, and Script B that wraps certain words in <strong></strong>
tags.
The scripts work great as long as I select, by hand, the text I want to work
with. At the end of the script, after I have done the operations I want to do,
I set the selection to the newly computed text.
The way it SEEMS to work is the selected text stays selected the whole time,
and at the very end I am writing into the selection. It is as if I pasted a
result into a selection— the selected text is replaced with what I pasted.
What I'm trying to do is automate the selections. That is, in the example
above, I want to (somehow) automatically select everything between the first
set of {Tag_A}{/Tag_A} tags, and run Script A on it. Then I want to (somehow)
automatically select everything between the first {Tag_B}{/Tag_B} tags, and run
Script B. Then I want to select the text between the next set of A tags and run
Script A, and then select the text between the next set of B tags and run
Script B, and so on.
Any suggestions? What I'm describing is sort of an invisible hand that makes
the selections for me. There might be a better way to do it so I am open to
suggestions!
I don't have any trouble with the Scripts A and B. Those are fine. What I need
is a way to tell BBEdit to select the right chunks of text to apply these
scripts to.
THANK YOU—
Christian Boyce
--
This is the BBEdit Talk public discussion group. If you have a
feature request or need technical support, please email
"[email protected]" rather than posting to the group.
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/bbedit/2C08A6D3-BA5F-41B8-A8DF-3ED3DF64E66C%40christianboyce.com.