Search/Replace autoupdate during macro execution?
Posted: Sat Feb 19, 2005 3:57 pm
I have a sorted list, a forum archive with posts formatted to one line each, lines sorted by subject into blocks. I need to insert blank lines between blocks to ease further work. I'd have the source data file open, and also one empty document to receive data from it.
My idea is to build a macro that iterates through each subject. This would be especially useful as it would not need a prior sort; it would do that as part of this procedure.
[Begin macro]
Ctrl + Home
Select the first subject field plus one extra character using Find RegExp.
Exit Find, modify selection with Shift + Left arrow, so that next Find looks for the subject string rather than reusing the previous expression, which just found the subject field.
Second Find. (For actual found subject string).
Mark all found lines.
Cut bookmarked lines.
Ctrl + Tab to Destination document and paste, add newline.
Ctrl + Tab back to Source document.
[End macro]
Repeat to EOF.
This only works for the actual string found when building the macro. This is often useful as it makes things very fast when working with specific strings or RegExp's, as in the first Find in this idea, but in this case I don't want the string stored in the macro for the second find, only the means to find it (which is stored in the macro for the first Find). That way I can run the macro to sort by any subject regardless of what it might be.
As it is, I either have the explicit string stored, so it only matches that used when building the macro.
Or, I use a RegExp, but then it will match every subject field in the file, which is equally useless in this case.
Is there a way around this?
_________________________________________
As a related question, is there now (or intended) a way to write scripted macros, not just to build them by recording keypresses? That could be powerful, and might make it easier to solve things like this.
My idea is to build a macro that iterates through each subject. This would be especially useful as it would not need a prior sort; it would do that as part of this procedure.
[Begin macro]
Ctrl + Home
Select the first subject field plus one extra character using Find RegExp.
Exit Find, modify selection with Shift + Left arrow, so that next Find looks for the subject string rather than reusing the previous expression, which just found the subject field.
Second Find. (For actual found subject string).
Mark all found lines.
Cut bookmarked lines.
Ctrl + Tab to Destination document and paste, add newline.
Ctrl + Tab back to Source document.
[End macro]
Repeat to EOF.
This only works for the actual string found when building the macro. This is often useful as it makes things very fast when working with specific strings or RegExp's, as in the first Find in this idea, but in this case I don't want the string stored in the macro for the second find, only the means to find it (which is stored in the macro for the first Find). That way I can run the macro to sort by any subject regardless of what it might be.
As it is, I either have the explicit string stored, so it only matches that used when building the macro.
Or, I use a RegExp, but then it will match every subject field in the file, which is equally useless in this case.
Is there a way around this?
_________________________________________
As a related question, is there now (or intended) a way to write scripted macros, not just to build them by recording keypresses? That could be powerful, and might make it easier to solve things like this.