Hi all:

Thanks for all the suggestions about replacing search mode:literal with search mode:grep (silly mistake on my part). Unfortunately, the error still occurs after I do so. Other thoughts?

Cheers,

Ian


On Nov 9, 2007, at 6:57 AM, Ian Crew wrote:

Hi all:

I'm trying to write an Applescript that uses BBEdit to do a replace using grep. My code currently looks like:

tell application "BBEdit"
        activate        
        open j opening in new_window
        tell text document 1
                activate
                set searchStr to "2007-08-\\d\\d"
                set replaceStr to "<!--MODDATE-->" & mod_date & 
"<!--\\/MODDATE-->"
replace (searchStr as string) using (replaceStr as string) options {search mode:literal, starting at top:true} searching in text 1 of text window 1
                save text window 1
                close window 1
        end tell
end tell


but, when it gets to the "replace" line, I get the error:

-1708
BBEdit got an error: "2007-08-\\d\\d" doesn't understand the replace message

I can't find any documentation about that error. Any ideas/help would be appreciated.

Thanks,

Ian


Ian Crew
Supervisor, Collaboration Services
Information Services and Technology-Data Services
University of California, Berkeley
2195 Hearst Ave, Second Floor
http://ist.berkeley.edu/ds/

2009 Chair, Chancellor's Staff Advisory Committee
http://csac.chance.berkeley.edu


Ian Crew
Supervisor, Collaboration Services
Information Services and Technology-Data Services
University of California, Berkeley
2195 Hearst Ave, Second Floor
http://ist.berkeley.edu/ds/

2009 Chair, Chancellor's Staff Advisory Committee
http://csac.chance.berkeley.edu

Reply via email to