How do you run a Macro on open files?

Help with writing and playing macros

How do you run a Macro on open files?

Postby jtp51 » Tue Dec 21, 2004 2:33 pm

Hopefully this is a simple question:

How do I just run Macro for only and all open files, is it a batch process?

Thank you.
User avatar
jtp51
Newbie
 
Posts: 5
Joined: Mon Sep 20, 2004 11:00 pm
Location: Omaha, Nebraska

Re: How do you run a Macro on open files?

Postby Mofi » Wed Dec 22, 2004 2:45 am

With the help of a second macro, which executes your macro on all open files. Here is this macro:

InsertMode
ColumnModeOff
HexOff
UnixReOff
Top
"MacroFirstFileMarker"
Loop
PlayMacro 1 "case-sensitive name of your macro"
NextWindow
Top
Find MatchCase "MacroFirstFileMarker"
IfFound
Delete
SaveAll
ExitLoop
EndIf
EndLoop

Remove the SaveAll command if you do not want to save all files after macro execution or you already save it during execution. Make sure, that your macro does not close the file at end of execution or you have to modify this macro.
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4055
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna

Re: How do you run a Macro on open files?

Postby JiTS_NL » Thu Feb 09, 2006 12:46 pm

Mofi,

I tried your advise but I get an error: "Search string not found!".

What do I have to change in your script?!? Everything between the quotes ""?!?
Is "MacroFirstFileMarker" a macro or a function?!? :?:
User avatar
JiTS_NL
Newbie
 
Posts: 3
Joined: Thu Feb 09, 2006 12:00 am

Re: How do you run a Macro on open files?

Postby Bego » Thu Feb 09, 2006 2:12 pm

JiTS_NL wrote:I tried your advise but I get an error: "Search string not found!".

Set the macro property (checkbox) "continue search if nothing found".

JiTS_NL wrote:What do I have to change in your script?!?

Just the red text with your macro name.

JiTS_NL wrote:Is "MacroFirstFileMarker" a macro or a function?!?

It's just a STRING, a Marker. You could replace it (both!) with "ABCXYZ" and it would work too. It just should be a unique string.

rds Bego
User avatar
Bego
Master
Master
 
Posts: 357
Joined: Wed Nov 24, 2004 12:00 am
Location: Germany

Re: How do you run a Macro on open files?

Postby JiTS_NL » Thu Feb 09, 2006 4:41 pm

Yes, I got it now... :)

Next question:
Is it possible to write "MacroFirstFileMarker" somewhere else in the first file, because during my other macro I delete the first row.
So at the end 'your' macro delete a piece of my data... :(
User avatar
JiTS_NL
Newbie
 
Posts: 3
Joined: Thu Feb 09, 2006 12:00 am

Re: How do you run a Macro on open files?

Postby Mofi » Thu Feb 09, 2006 5:07 pm

The marker string can be placed anywhere, for example at the end of the first file.

Bottom
"MacroFirstFileMarker"
Top
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4055
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Macros