Page 1 of 1

Disable F&R message if search failed

Posted: Thu Nov 10, 2022 10:07 am
by wanglong
When I use ".uno:ExecuteSearch" to find some String that not be found,I don't want the dialog"The OpenOffice Writer has found the end location of the document. Whether you want to continue the search from the beginning of the document".

How to disable or auto click it and finish the find process?

Please help me , thx!!! :super: :super: :super: :super:

Code: Select all

PropertyValue[] property1 = new PropertyValue[]{new PropertyValue(),new PropertyValue(),new PropertyValue()};
        property1[0].Name = "SearchItem.SearchString";
        property1[0].Value = find;
        property1[1].Name = "Quiet";
        property1[1].Value = false;
        property1[2].Name = "SearchItem.SearchFlags";
        property1[2].Value = 71680;       //find in selected range 
        PropertyValue[] property2 = new PropertyValue[]{new PropertyValue()};
        property2[0].Name = "Select";
        property2[0].Value = true;
        PropertyValue[] property3 = new PropertyValue[]{new PropertyValue()};
        property3[0].Name = "Text";
        property3[0].Value = replace;
        do{
            xTextViewCursor.gotoRange(xTextRangeA, false);  //to start
            long index = N;
            while(index-- > 0){
                xDispatchHelper.executeDispatch(xDispatchProvider, ".uno:GoDown", "", 0, property2);  //go down N line
            }
            DispatchResultEvent oo = (DispatchResultEvent)xDispatchHelper.executeDispatch(xDispatchProvider, ".uno:ExecuteSearch", "", 0, property1); //find matched string
            if((boolean)oo.Result == false)
                break;
            xDispatchHelper.executeDispatch(xDispatchProvider, ".uno:InsertText", "", 0, property3);
        }while(true);
At first,I think Para"find in selected range:71680" will meet my demand,but the result just disappointed me!! :crazy: :crazy:

Re: How to disable F&R Reach the Bottom message dialog?

Posted: Thu Nov 10, 2022 11:58 am
by Villeroy
http://fivedots.coe.psu.ac.th/~ad/jlop/#writer (Chapter 9. Text Search and Replace [XSearchable])
 Edit: 2024-02-28: Broken link -- MrProgrammer, forum moderator  

Re: How to disable F&R Reach the Bottom message dialog?

Posted: Thu Nov 10, 2022 12:00 pm
by RoryOF
I think it might make sense to disable that warning for macro F&R operations if (and only if?) the search process has commenced from the very start of the file, so that the entire file had been searched; then the message is redundant.