Canvas X Move/Resize Palettes

My QuicKeys is dead as of MacOS Catalina.

I had various macros and one of them positioned the palettes on my second monitor for Canvas X.

I can't find any information regarding accessing window id's for the palettes in Canvas X.

They aren't normal Finder windows and my level of skill at this point in making Keyboard Maestro provide these actions on the Canvas X sub-windows (or whatever they're termed) has failed.

The Keyboard Maestro Wiki doesn't seem to have an useful information regarding these type of windows either.

Hey @callison,

Welcome to the forum!  :sunglasses:

The problem here is that Keyboard Maestro doesn’t see non-standard windows...

Personally I wish it did, but this is a design aesthetic Peter has decided upon up to now.

You'll have to resort to AppleScript in an Execute an AppleScript action.

You'll most likely have to resort to System Events to do this:

tell application "System Events"
   tell application process "Canvas"
      set winNameList to name of windows
      set winPosList to position of windows
   end tell
end tell

** Rename “Canvas” in the script if necessary.

Returns lists of window names and positions.

Position your palettes as desired and run this script in Script Debugger (or Apple's anemic Script Editor app if you're a masochist).

Script Debugger Plug

When writing and testing AppleScript on macOS I advise folks to use Script Debugger – even if they don't write much AppleScript.

I've used it for 26 years plus and cannot begin to express how much it changed the AppleScript experience for me.

The commercial version is not inexpensive ($99.99), BUT it reverts to its FREE “Lite” version after a 30 day demo period – and the free version still beats the utter pants off of Apple's Script Editor.app.

Setting window positions goes something like this:

tell application "System Events"
   tell application process "Canvas"
      tell window "window name"
         set its position to {23, 0}
      end tell
   end tell
end tell

-Chris

That inablility to see non-standard windows is what has me leaning on cliclick and osascript. So far I've been able to use Keyboard Maestro to replace exactly one action that I call from a shell script.

While I like and use cliclick for testing now and then, KM's Move or Click Mouse action does most of what I need.

I've shown you how to talk to your palette windows directly using AppleScript, and you can run that from KM.

There are several things QuicKeys could do that I miss, but I've gotten used to how KM works over the last couple of decades and can work around most issues.

A new question: Can Keyboard Maestro move a window by it's ID?
The "Move and Resize Engine Window with ID " doesn't seem to work.

A recap of the problem:

I'm still searching for a method that will apply to my problem of moving palettes in "Canvas X Draw". The osascript provided by ccstone didn't yield a name but I did find a GetHub binary that will provide the window ID. GitHub - smokris/GetWindowID: macOS command line utility to retrieve the CGWindowID of the specified window (potentially useful for `screencapture`).

With that I can get the id's, names and positions of the windows but KM doesn't seem to accommodate this information. I'm not very conversant in KM as of yet and perhaps never will be so I'm hoping someone can point me in the right direction.

Running the GetHub code in shell:

[me]: getwindowid "Canvas X Draw" --list
"File" size=194x334 id=279
"Find" size=342x509 id=257
"(null)" size=71x454 id=244
"floors.cvd" size=2147x1295 id=243
"Navigator" size=411x486 id=262
"Presets" size=334x327 id=259
"floors.cvd" size=2165x1407 id=235
"Document Layout" size=321x486 id=245
"Align" size=272x296 id=254

The QuicKeys code for one of these palettes would read:

     "ShortcutStepArchivePluginStep" => {
      "WindowArrangementArchiveActionKind" => 1
      "WindowArrangementArchiveTargetApplicationName" => "Canvas X Draw"
      "WindowArrangementArchiveTargetWindowFindByIgnoringCase" => 1
      "WindowArrangementArchiveTargetWindowFindLevel" => 1
      "WindowArrangementArchiveTargetWindowFindMode" => 0
      "WindowArrangementArchiveTargetWindowFindMultiplesTiebreaker" => 1
      "WindowArrangementArchiveTargetWindowFindName" => "Document Layout"
      "WindowArrangementArchiveTargetWindowFindNameIdentMatchMode" => 0
      "WindowArrangementArchiveTargetWindowType" => 2
      "WindowArrangementArchiveTilePreference" => 0
      "WindowArrangementArchiveVersionKey" => "1"
      "WindowArrangementArchiveWindowPositionChanges" => 1
      "WindowArrangementArchiveWindowPositionRootLeftRight" => 100
      "WindowArrangementArchiveWindowPositionRootTopBottom" => 200
      "WindowArrangementArchiveWindowResizeRect" => "{{2850, 693}, {376, 486}}"
      "WindowArrangementArchiveWindowSizeChanges" => 1
      "WindowsArchiveStepKind" => 1
    }

That's the guts of the QuicKeys method which I've provided merely for illustration. The only applicable part would be the actual window position. However, I imagine that KB is internally similar but still lacks the facility at this point for these non-standard windows.

The question now becomes:
The KM "Move and Resize Engine Window with ID " doesn't work. Is there another KM function that I should try?