- v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
- Use this page to report any issues related to the migration.
v0.34:Cleaning up macros
Cleaning up Macros
This page is dedicated, on to describe, and help in cleaning macros. This is needed, because a recorded macro contains quite a lot of other interface interaction, what can really slow the executing.
Because DF has a cache for the macros, you must change at least the name of the macro inside it (use a counter, and increment it), otherwise, the oldest loaded version will be used :(
If you make your macros to do a repetative job in a single menu, you can easily use grep and a menu macro file. Grep[1] is a GNU utility, that process an input (text) file, and throws everything, that doesn't match the filtering options. It's a very powerful utility, so if you would like to know better, look into manual[2]. Because grep is case sensitive (CAPITAL non capital), you have to watch out for this, or use a -i (in-case sensitive) mode.
How to use them
Because grep is not saving the first line (name of macro), you have to make it manually. You have two choices. You can create a file, with the appropriate menu name, for example build.menu, and then:
echo my2 > my2.mak grep -f build.menu my.mak >> my2.mak
The first line is writing my2 (the name of the macro) into the file. This operation will overwrite the existing content of the file. The second line is actually doing the filtering, and appending the file. (Don't run, otherwise you wish to double the macro, you will still have to delete the End of macro line from the middle of the file)).
If you wish to build anything, and you are not intended to leave the build menu, and the macro is not selecting the building type, you can use the following file / listing to filter your macro. (so, for 'you manually select the first position, and the building type, and then run the macro' type of macros).
SELECT End of group CURSOR_ End of macro