Hi Mathias, Alle 22:25, lunedì 20 febbraio 2006, Mathias Bauer ha scritto: [...] > It doesn't make any sense to record a S&R action that does not > automatically replace all occurences or no occurence and asks the user > for every single case. > > A macro that e.g. only replaces the 3rd and the 5th occurence can't be > applied to other documents in a useful way.
I agree, but actually the user *can* record such actions, even if it doesn't make sense. IMHO this kind of problems should be intercepted "before" , e.g. disabling certain actions or controls during the recording process. I'm thinking for example to the mouse selection in Writer, or in this case, the button "replace" in the S&R dialog, or also multiple selections in Calc, and so on. Disabling certain commands during recording would make the generated code more consistent and perhaps would improve easeness of use. BTW if I well remember, in an old version (perhaps 1.1.2 ?) you used this technique in Writer (disabling mouse for text selections), but in subsequential version this feature disappeared. > So what you need is "Replace > All" and "Start Replacing and ask me each time". AFAIK the latter is > possible only by dispatching because it's bound to a dialog while the > S&R API of the "core" document explicitly is designed to avoid dialog > interruptions. I'm not sure to understand you: If you record a S&R (in Calc) with the macro-recorder you will see that each time that you will press one of the 4 buttons available on the S&R dialog: Find Find all Replace Replace all a dispatch ".uno:ExecuteSearch" will be recorded. This dispatch has an argument that contains the information of which button has been pressed: SearchItem.Command : 0=findFirst, 1=findAll, 2=replaceFirst, 3=replaceAll So, back to my scenario: My purpose, in a few words, is to translate automatically a dispatch based macro into a "regular" API based macro. (And BTW it's great to share thoughts with the author of the OOo's Macro Recorder :-) To accomplish this, my service processes recorded dispatches one by one So my macro-recorder should do the following task during the basic code generation: (in 'very-pseudo' code) for each recorded dispatches-> Is dispatch == ".uno:ExecuteSearch" ? -> then check the SearchItem.Command -> if SearchItem.Command==0 then use this API translation : "oActiveSheet.findFirst(oDescriptor)" elif SearchItem.Command==1 then use this API translation : "oActiveSheet.findAll(oDescriptor)" elif SearchItem.Command==2 then use this API translation : "*****dont know*****" elif SearchItem.Command==3 then use this API translation : "oActiveSheet.replaceAll(oDescriptor)" My problem is actually only the case SearchItem.Command=2 (replace first) because I've not a direct API "traslation" for this command. Thank you Paolo Mantovani --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]