Hi Murat,
Might it be that the insertion point in your file is past the <title> tag
and the find wrap around option is not set?
Try setting the "wrap around" option to true in the find command:
*find* "<title>" searching in *text* 1 *of* *text window* 1 options {search
mode:*grep*, starting at top:*true*, wrap around:*true*, returning results:
*true*} *with* selecting match
The find command has various options as reported in the BBEdit dictionary:
Search Options n : Options for “find” and “replace” commands properties
search mode (literal/grep) : the type of search (literal search if omitted)
starting at top (boolean) : start from the top of the document? (false if
omitted)
wrap around (boolean) : should the search wrap from the end of the
document? (false if omitted)
backwards (boolean) : should the search proceed backwards? (false if
omitted)
case sensitive (boolean) : should the search be case-sensitive? (false if
omitted)
match words (boolean) : should the search only find whole words? (false if
omitted)
extend selection (boolean) : should the selection range include the
original selection start through the end of the match? (false if omitted)
returning results (boolean) : if performing a batch or multi-file search,
return a list of matches? (false if omitted)
showing results (boolean) : if performing a batch or multi-file search,
open the list of results? (true if omitted)
HTH
Jean Jourdain
On Monday, June 28, 2021 at 2:47:56 PM UTC+2 Murat wrote:
> Hello,
> I am new to BBEdit. I have searched this forum but have not been able to
> locate a discussion relevant for my problem. I am maybe doing something
> stupid but, I cannot make BBEdit find an HTML using it through Applescript,
> in a document that definitely includes this tag.
> My simple script is:
> tell application "BBEdit"
> open (alias "path to my file") -- this file opens, no problem, using
> the real path that I do not give here
> set result to (find "<title>" searching in text of text window 1 with
> selecting match)
> set mytext to text of text window 1 -- this text is good and contain
> then <title> tag
> end tell
>
> But the tag is not found and the result variable is not created with the
> result of the search.
>
> I can search <title> directly in BBEdit, and it of course finds it.
> I have tried to escape then < and > characters but of course this does not
> make sense for Applescript either. These characters do not need escaping I
> think.
>
> I am a bit lost here because I do not see why BBEdit cannot find the tag
> in a file that contains it. Any help would be very much appreciated.
> Very cordially,
>
> Murat
>
>
--
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 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/bbedit/66cf32c0-02db-4a76-9d96-eab7cea98849n%40googlegroups.com.