KM macro help for Digital Performer 9 please!

Hi All,
I am a Quick Keys refugee new to Keyboard Maestro. I intend to use it primarily in Digital Performer. I have created a few Macros already, but it has been suggested I may not be going about it in the most ideal, the most robust way.

QUESTION: is anyone in the Forum wizened in the art of using KM with DP 9? I am having trouble finding instructional videos that pertain to the way I am trying to use the program: open various edit windows, click on various buttons within those windows, and enter numbers in the text boxes.

Hey Michael,

I hope not...

wizened --> "shriveled or wrinkled with age"

:smile:

There are a couple of guys on the forum who've done things with DP though, and hopefully they'll chime in.

--
Best Regards,
Chris

Thanks Chris. Hope to hear from some DP users soon. I am not fussy: I’ll take shriveled wisdom over my inexperience any day!

Chris,
Perhaps you could give me a few pointers. Here is one of my first Macros.

I want to:

  1. Select Scale Time from the Regions menu.
  2. Click in a text box that addresses the % by which midi information is to be scaled.
  3. Command A & Delete to remove any previous info
  4. Click again to select the check box
  5. Type in the given percentage, in this example, 20.
  6. Close the window.

This is the macro I built:

Activate Digital Performer
Select ‘Scale Time…’ in the Menu ‘Region’ in Digital Performer
Pause for .15 Seconds
Move and Click at (246,111) from the Top Left Corner of the Front Window
Type the ⌘A Keystroke
Type the Delete Keystroke
Pause for .15 Seconds
Move and Click at (246,111) from the Top Left Corner of the Front Window
Pause for .15 Seconds
Insert Text ‘200’ by Typing
Pause for .15 Seconds
Move and Click at (275,182) from the Top Left Corner of the Front Window

Chris, you have to quit talking about me like that. :laughing:

Hey Michael,

Without having my hands on the app it's very difficult to know how to move and shake it.

I took a look at it on Google Images, and the UI is quite complex.

I don't get any sense from a brief look on the Net that it is AppleScriptable.

Therefore you're left with things Keyboard Maestro can see. KM can see menus, buttons, windows, but some software is implemented such that KM cannot see certain elements.

KM can find images on the screen, so you can use those as anchors.

When possible let KM drive menu items or keyboard shortcuts to do what you need and navigate where you need to go.

Don't rely on clicks unless you have to. When you have to try to make them as bombproof as possible by making sure the window is always the same size and configuration and anchoring them the best possible way — be that by screen coordinates, window coordinates, or the coordinates of a found-image.

Your pauses are probably longer than necessary. I usually get by with 0.05 seconds for small things, but you can play with the timing until it's not overly long and still reliable.

That's about I all I can think of at the moment.

-Chris

Hi Chris,
Thanks for your quick response. I am all for eliminating Clicks, I made a number of DP window screenshots to help you better see what I'm trying to accomplish:

:

My aim is to automate automate as much of my workflow as possible: the clicking of buttons, typing numeric values, creating virtual instrument tracks, etc. Fortunately, none of these windows resize. Behavior is pretty uniform, as is the basic look from widow to window.

Based on what you see, would I be better off manipulating the coordinates of a found image than building clicks? If so, an example or two would REALLY help.

Thanks in advance,

Michael

Hey Michael,

The first thing I'd do is find out what Keyboard Maestro can see.

Unfortunately there's not a way to discover buttons, so you have to experiment.

Try creating a 'Press a Button' action for "Harmonize" in the first window.

If KM can see the checkbox then you have something to work with.

I'd also try working the keyboard.

Where does Tab take you in one of these windows?

Can I open the window, type TAB, TAB, and then enter the value I want?

What happens if I turn ON 'Change the way Tab moves focus' in System Prefs > Keyboard > Shortcuts Pane?

The keyboard shortcut for it is normally Control-F7.

When you do that where can you TAB to in these windows?

After that I'd download the UI Browser demo from Home - ID-Soft PFdle (commercial utility).

And I'd start looking to find out what interface elements it can see.

You can also install Xcode and use the Accessibility Inspector.app, although it is not nearly as helpful as UI Browser.

The windows you provided images of look like they might be amenable to UI-Scripting, but you won't know until you start investigating.

In summary:

I think you can do a fair amount in a quick and dirty fashion using menus, and driving the keyboard and mouse.

I think Keyboard Maestro might be able to see some of the available buttons.

I think you can build a much more solid workflow IF System Events can see the interface elements of Digital Performer — because you can check for state and perform actions based on that state.

-Chris

Hi Chris,

Thanks for the input. I am gradually getting the hang of things.in KM.

I already had the ‘Change the way Tab moves focus’ in System Prefs > Keyboard > Shortcuts Pane enabled in Prefs. Tab selects contents when toggling through checkboxes, so this is an improvement to clicking on the checkbox, command A selecting the contents, deleting and typing new stuff.

I tried the “press a button” (Harmonize, as you suggested) action in the Transpose Window and as we feared, it did not work.

I have downloaded the UI Browser APP, and I may have to use it to see what’s in these DP windows, though this was my last resort, since the program sounds daunting too.

I do not know what UI Scripting is. Is this done through the UI Browser, or???

Many Thanks,

Michael

Hey Michael,

UI-Scripting is done with AppleScript via System Events and drives the OSX User-Interface much like Keyboard Maestro does.

It's generally slower than KM, but it has the advantage of seeing things KM doesn't.

An example:

tell application "System Events"
  tell application process "Safari"
    tell group 1 of text area 1 of group 136 of UI element 1 of scroll area 1 of group 1 of group 1 of group 2 of front window
      set discourseEditorTextFromSafari to value of every static text
    end tell
  end tell
end tell

set AppleScript's text item delimiters to {linefeed}

set discourseEditorTextFromSafari to discourseEditorTextFromSafari as text

If you run this from the Script Editor.app (Applescript Editor in Mavericks and lower) with the KM forum editor open with some text in it, that text will be returned.

As you can see it's a fairly convoluted script, but UI Browser allowed me to figure it out in just a few minutes.

So, yes — UI-Scripting is very intimidating to begin with — but with some mentoring you should be able to use it without spending hours in the gym.

-Chris

Yikes! This is pretty daunting, but I will open the UI Browser tonight and see what I can discover.

Thanks, Chris.

Michael

Hey Michael,

Yes, it's very scary when you first start working with it.

Look in the preferences in the 'Screen' pane. There are keyboard shortcuts to activate UI Browser in a point-and-shoot sense, so you can put the cursor on a UI-Element you want to explore and hit the hotkey.

This is much better than trying to browse through the myriad elements of and app and manually find the one you're looking for.

-Chris

I’m interested in this discussion because I’m an avid DP9 user and a beginner/intermediate KM user. I have had some success in simply creating mouse clicking macros since, as long as they’re relative to the frontmost window (and you can even add a check to make sure a specific window like Scale Time is frontmost) the clicking is reliable.

DP is definitely not AppleScriptable.

Hey David,
It’s been quite a while since we have spoken! Glad you too are exploring KM with DP 9 too.

Call me when you are free.

Michael Harriton
Heavenworks
Sent from my iPhone

Nice to find you here too!

Keep me posted. I’m intrigued by Chris’s post above but honestly, I’m not sure I understand it. I’d love to see a video demonstration of someone doing this (preferably specifically with DP, but not necessarily so) so I can get a better handle on how it works and what possibilities it opens up.

Are there any KM videos on YouTube that demonstrate this? I searched but couldn’t find any.