I am trying to delete the last section of a web page with AppleScript. I 
search for a comment near the end of the page and then search backwards for 
the div. So far so good. Having selected that div with the find command, I 
can t delete the selection.

I have tried...

delete selection
set the selection to ""
set selection to grep substitution of ""

They have all worked at some point but not reliably.

What am I missing here?

TIA


tell application "BBEdit"
    activate
    find "<!-- right column -->" searching in text 1 of text document 
"indextest.html" options {search mode:literal, starting at top:true, wrap 
around:false, backwards:false, case sensitive:false, match words:false, 
extend selection:false} with selecting match
    
    set t to find "(^\\s*<div class=\\\"day_report\\\">(?s).*?</div>\\r)" 
searching in text 1 of text document "indextest.html" options {search 
mode:grep, starting at top:false, wrap around:false, backwards:true, case 
sensitive:false, match words:false, extend selection:false} with selecting 
match
    
    if the found of t then
        set selection to grep substitution of ""
    end if
end tell

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or would like to report a problem, please email
"supp...@barebones.com" 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 bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.

Reply via email to