In this tutorial, let's pretend that we need a Macro to add 8 Mono Audio Tracks to our Cubase Project.
Please note that DTouch for Cubase version 1.1.12 or later is required in order to use the Macros attached to this topic, since we are using new Macro Engine functions that weren't available in previous DTouch versions.
First of all, we think about our "problem" and find a way to solve it by using Cubase directly:
- We choose the "Project" >> "Add Track" >> "Audio..." Cubase menu.
- The "Add Audio Track" window appears.
- We select "Mono" from the configuration.
- We double-click on the "Count" number and type "8" on our keyboard
- We hit Enter on our keyboard
We'll now try and translate this list of actions into Macro Commands for DTouch,
aiming at building the simplest possible Macro, and improving it on next steps.
For Step (a), we use the "Cubase Key Command" Macro Command in DTouch.
Select the "Add Track", "Audio" parameters for that Command.
Now, the "Add Audio Track" window would be there, but since we may have a heavy-loaded system while we run this Macro, let's add a little pause after this, in order to give it some time to appear.
Add a "Sleep" Macro Command, with a 500ms parameter.
This is Step (b) of our list of actions.
Let's look at the window that just appeared. Since Cubase remembers some parameters from the last time that we used this window, we need to set them, even if they are already correct for our current Macro.
We now need to select "Mono" as configuration (even if it's already set).
This is Step (c) of our list of actions.
The easiest way to accomplish this with DTouch is:
- Open the "Add Audio Track" window, using the Cubase Menu "Project" >> "Add Track" >> "Audio..."
(You can temporarily minimize the Macro Editor in order to perform this) - Select a "Mouse Move" Macro Command
- Tick (enable) the "Relative to Fg" checkbox (see note *1 below)
- Move your mouse exactly over the "Mono" Configuration type, and press the F2 key on your keyboard.
The exact spot we used for this Command is indicated by the red arrow on the above image.
The F2 key has populated the x,y coordinates with the current mouse location.
Add this Macro Command to the Command list by pressing "ADD". - Add a little pause, to stay safe: Add a "Sleep" Command, with a 50ms parameter.
- Add a "Mouse Left Button Click" Macro Command
- At this point, the Macro would have clicked on our defined point, and a pop-up menu would have appeared.
Let's add another little pause, to stay safe: Add a Sleep Command, with a 50ms parameter. - We now need to select "Mono" from the pop-up menu, and will do that using keyboard keypresses.
- Add a "Keyboard Shortcut" Command, with the DOWNARROW parameter. (Tip: in order to add the parameter, you actually need to press the down arrow key on your keyboard!)
- Add a "Keyboard Shortcut" Command, with the ENTER parameter.
- At this point, the pop-up menu would disappear, and we add another 50ms "Sleep" Command to stay safe.
- Open the "Add Audio Track" window, using the Cubase Menu "Project" >> "Add Track" >> "Audio..."
(You can temporarily minimize the Macro Editor in order to perform this) - Select a "Mouse Move" Macro Command
- Tick (enable) the "Relative to Fg" checkbox (see note *1 below)
- Move your mouse exactly over the "1" Count, and press the F2 key on your keyboard.
The exact spot we used for this Command is indicated by the yellow arrow on the above image.
The F2 key has populated the x,y coordinates with the current mouse location.
Add this Macro Command to the Command list by pressing "ADD". - Add a little pause, to stay safe: Add a Sleep Command, with a 50ms parameter.
- We now need to double-click on that number. To do this, we add TWO "Mouse Left Button Click" Macro Commands.
- At this point, the number should be editable. Add a 50ms "Sleep" Command, to stay safe.
- We need to enter "8" in the Count, and for that, we'll add a "Type Text" Macro Command, with "8" (without quotes) as parameter.
- Add another 50ms "Sleep" Macro Command to stay safe.
Since we are building a good Macro, we'll add another 1000ms "Sleep" Macro Command, in order to give Cubase the time to add the 8 new Tracks to the Project, and finally we'll add a "Update DTouch Mixer Graphic" Command in order to tell DTouch to refresh its Mixer graphic state (since the new Tracks could have moved the Cubase Mixer around).
That's all for now!
The Macro we just built does accomplish the required task, and some of our users may even be completely satisfied with this one.
This is OK, since we designed DTouch to be flexible and adaptable to the different workflows of our users.
But, we want to write the best Macro we can, and so will improve this one in the next steps.
The Macro, as described in this post, is attached.
NOTES:
- The "Relative to Fg" setting is important, since that makes your mouse movement relative to the current foreground window.
This makes the Macro more flexible, as it is not strictly bound to where the window is currently placed.
We strongly encourage the use of relative mouse coordinates, and the Macro Editor makes use of such coordinates
when possible, in order to help you write better and universal Macros.