Moving a section of a MS Word window

I'm getting stuck trying to move a "section" of an MS Word window. In Word, you can show the Styles Panel:

This panel is actually detachable if you click and drag where it says "Styles" in the panel:

I'd like my final result when I trigger the macro to be like this:

so that the Styles Panel is dragged to the absolute left edge of the window and the panel is resized to its minimum horizontally but maximum vertically so it extends the whole height of the monitor.

Most likely the best solution here is to use AppleScript to manipulate the windows. I'm not a good AppleScript programmer. And I'm not sure if MS Word for macOS is AppleScript friendly. So that may not work.

However there's a chance that another approach is to use Mouse clicks. But you didn't say if the Word window will always be in the same place. If it's always in the same place, this might be easy to solve with mouse clicks. In fact, it might be solvable using the built-in KM feature called "Record". You could read up on that feature and give it a try. I can't try it for you because I don't have MS Word.

Lastly, you didn't indicate how you got from your second image to your third image. What did you do to stretch that window on the left side?

Thanks for your reply. I am exploring the Mouse clicks option because the Word window will always be in the same position—full screen all the way to the right-hand side of the monitor and always the same width (this is because Word remembers the window position and sets each new window to the same as the one before it).

Once the Word window is open and I show the Styles Panel, I would then trigger the macro. When you drag the Styles Panel out of the main Word window to reposition it, it drags at a predetermined size. That's what you're seeing in the second screen shot. The Styles Panel then needs to be resized by dragging the lower right-hand corner to the size shown in the 3rd screen shot.

It sounds to me like what you want (and need) is a simple macro with a hotkey. You need to come up with a hotkey that will execute two actions that look something like this:

image

Notice that this action contains the options "and drag absolute" and "main screen's upper left corner". What you need to do is find the correct coordinates for each of the boxes that contains "0". I can't find those values for you because my screen has different coordinates than yours.

You will need two of these actions. The first one will move the Styles pane from the right to the left. Then the second one will stretch the bottom corner of the style pain from the middle to the bottom.

I'm not sure if Word requires a small Pause between both of those actions. You may need to insert a small pause action between them.

Here's a version I came up with that doesn't rely on window position or screen resolution, so it should work without any changes on any Mac you use.

Detach and position Styles pane.kmmacros (8.0 KB)

It opens the pane, moves it a bit to detach it, then moves and resizes it to to the top left edge of the screen at the narrowest possible width and full height. It then moves and positions the main Word window to take up the rest of the screen.

The narrowest bit is just some laziness on my part: It'd be easy to figure out that window's exact minimum width, but I just made it minimum width and saw that it was over 200 pixels. If you set a window below its minimum width, it will resize to its minimum width, so I set the width to 200.

This works for me in testing here with the latest version of Word.

-rob.

3 Likes

Thank you Rob—that's incredibly kind.

Ultimately, I don't think Word plays nice, as I can't make this work reliably. It moves things around, sometimes showing the Styles Panel after it moves it, sometimes not. Sometimes moving the main Word window around, sometimes not. And some times it doesn't detach the Styles Panel at all.

As an Editor, arranging the Word workspace this way is something I do a dozen times a day, every day of the week. I'll keep banging on this and maybe I can get it to work eventually.

Try this version:

Detach and position Styles pane v2.kmmacros (7.7 KB)

I've added a 0.25 second delay between actions; if the macro still misbehaves, change the value in the green box to something higher. It may take some experimentation to find a time that works for you. I also changed how the main Word window is reactivated after dealing with the Styles window; this should be 100% effective regardless of the main window's size/position/

The really sad part about all of this is that, on Windows, there's supposedly a drop-down menu in the Styles panel you can use to detach it. That menu doesn't exist on the Mac version, and the only way I could find to detach it is by dragging. And unfortunately, that's a flaky thing to have to do via automation.

-rob.

I think your best bet is to position the document window, then detach the Styles pane, then move it. Assuming the pane isn't already showing:

Open and Position Styles Pane.kmmacros (12.9 KB)

Image