Re: Searching an html tag with Applescript and BBEdit

2021-06-29 Thread Murat
Thank you very much for all your help! It now works indeed and it is pretty quick in comparison with my actual solution with another text robot. set myfile to alias "full HFS file of the file to be searched in" tell application "BBEdit" set docRef to open myfile set foundRec to (find

Re: Searching an html tag with Applescript and BBEdit

2021-06-29 Thread Christopher Stone
On 06/29/2021, at 00:37, Murat mailto:myi...@gmail.com>> wrote: > set result to (find "" searching in ¬ > (alias "full HFS path to my file") ¬ > options {starting at top:true} with selecting match) > > if (found of result) then . > > Script debugger tells me,

Re: Searching an html tag with Applescript and BBEdit

2021-06-28 Thread Murat
Hello again Jean, When I do this: set result to (find "" searching in ¬ (alias "full HFS path to my file") ¬ options {starting at top:true} with selecting match) if (found of result) then . Script debugger tells me, for the last line Variable result is

Re: Searching an html tag with Applescript and BBEdit

2021-06-28 Thread jj
Murat, To have a result with the found object you have to remove the "returning results" options or set it to false in the find command. *tell* *application* "BBEdit" *set* result *to* *find* "" searching in *text* *of* *first* *window* options {starting at top:*true*} *end* *tell* Result:

Re: Searching an html tag with Applescript and BBEdit

2021-06-28 Thread Murat
Yes! These options helps to find the text now but the replace part poses a problem now (I do not use the grep here because it is a simple substitution: -- THis script is directly adapted from the BBEdit manual, page 335 tell application "BBEdit" set result to (find "" searching in ¬

Re: Searching an html tag with Applescript and BBEdit

2021-06-28 Thread Murat
Thank you very much Jean, I will explore these options to check if they solve my problem. Indeed, I have assumed that if I open the document, the cursor would be at the beginning of the file, which is not necessarily true. I have seen these options in the dictionary but was not sure how to use

Re: Searching an html tag with Applescript and BBEdit

2021-06-28 Thread jj
Hi Murat, Might it be that the insertion point in your file is past the tag and the find wrap around option is not set? Try setting the "wrap around" option to true in the find command: *find* "" searching in *text* 1 *of* *text window* 1 options {search mode:*grep*, starting at top:*true*,

Searching an html tag with Applescript and BBEdit

2021-06-28 Thread Murat
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