My first experience of a macro was many years back when Runescape was all the rage and occasionally whilst playing you would come across lvl 3 players walking straight to a place to mine or chop trees, continuously mine or chop for 30 minutes and then walk to a bank to deposit the resources and repeat this process instantly again. I ask my friend “how are these people able to do this and not get bored?” to which he told me they were using a mystical macro that did it for them, and I didn’t think any more on macros…. until we were introduced to macros at The Dataschool! I am hoping I can break down the different types of macro in this blog post using this game example to give you an understanding of how they work.

There are four types of macro (in Alteryx at least): Standard, Batch, Iterative and Location Optimiser. These macros can be used in different ways to clean up workflows and create simplicity for users. I will go through each type of macro and give context to each one.

The Standard Macro:

This is macro that runs once which holds within it a process that is either used a lot and much easier to insert as a single tool or is very messy and putting it into a macro tidies up the workflow a lot. In the macros I created to solve equations I used a Standard Macro to set up the process for the iterative macro and give the user the minimal amount to have to input. So in the idea of the game, imagine a new player is spawned in a certain area but has to be in a different place for the bulk of the process to run. The player could get the character to move to this position, and maybe do a few things on the way (like buy a pickaxe), but this process will have to be done for any new characters the player makes too, but only once for each. So a Standard Macro can be used to wrap this process into one, say: move character from point A to point B and buy a pickaxe from point C on the way. This Standard Macro can then be run on each new character to ready it for the rest of the process without the effort of going through multiple moves every new character they make.

The Batch Macro:

This is a macro which runs multiple times in a workflow and creates an output every time it is run. These are generally used when a process needs to be done a big amount of times and running the process that many times at once will cause problems, so a Batch Macro will break this up and complete manageable chunks at a time. In the idea of the game, suppose the player is wanting to create 1000 characters to get up to level 100 mining but can only run 10 tabs of the game at a time. The player can create a Batch Macro to break up creating 1000 characters into creating 10 at one time going through the process and outputting 10 characters each run. The Standard Macro mentioned can be included in the Batch Macro to get the 10 characters into the correct place before the Batch Macro starts another batch of the character creations.

The Iterative Macro:

This is a macro that runs a process over and over until either a condition is met or a certain number of runs have been completed before it creates an output. In Alteryx a filter can be easily used as the tool to make the conditioning, the macro will continue to run until the process passes through the filter as ‘true’ and then is outputted. In the idea of the game, when the character is ready to start its levelling journey several Iterative Macros can be used to get the character to level 100 mining. The largest can be checking if the character is at level 100 yet, the Iterative Macro can repeat the process of going from the bank, to drop off all inventory, to the mining spot, to mine until the inventory is full, and then returning to the bank. When the character returns to the bank the Iterative Macro checks to see if the mining is at level 100, if it is then the process is complete and the character logs out, but if not then the process of going to the mining spot is repeated again. Another Iterative Macro being run is making the character mine an area after the character reaches the mining spot. After each ore has been mined, the Iterative Macro checks to see if the character’s inventory is full, if it is then the macro ends and the character continues on with going to and from the bank, but if the inventory is not full the then the process of mining is repeated again until the inventory is full.

The Location Optimiser Macro:

This is a macro that runs multiple times in order to determine the best location for a set of parameters, such as closest or highest quality. Like Google Maps telling you where the nearest restaurants are to you, but suggesting one that is close but also above average rather than just the closest, the Location Optimiser Macro can weight certain parameters against each other to give suggestions. In the idea of the game, suppose there are a cluster of mining point in one area and after each point has been mined there is a respawn time of the ore from the spot being available again. The character can either wait at this point and continually try mining until the ore is available again, or a Location Optimiser Macro can be run when the character is idle to see where the nearest point is that has ore available. The Location Optimiser Macro then makes a suggestion to the macro above it to try mining a point close to the character, after the character mines this point the Location Optimiser Macro is run again to see where to mine next and so on. The Location Optimiser Macro can also be used to find the nearest mining spot from the bank, or find a spot close by that maybe has less dangers surrounding it than the spot which is closest.

That is a brief explanation of how each of the different types of macro work, and examples of how the might be used in a horribly nerdy and specific way! If this explanation helps at all then please let me know, or if I should write a similar blog but with more widely used cases as examples then also let me know.