Shortcut for aligning shapes in PowerPoint

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
hotkeyuser1234
Posts: 92
Joined: 07 Mar 2020, 12:27

Shortcut for aligning shapes in PowerPoint

29 Apr 2020, 03:06

Dear community,

Is it possible to align shapes in PowerPoint with a custom shortcut? I would really appreciate if you could help me to set up e.g.

Code: Select all

CTRL + ALT + Arrow right/left/top/bottom
for aligning right/left/top/bottom.

Thank you for your help!
User avatar
boiler
Posts: 16955
Joined: 21 Dec 2014, 02:44

Re: Shortcut for aligning shapes in PowerPoint

29 Apr 2020, 03:28

Code: Select all

 #IfWinActive, ahk_exe POWERPNT.EXE
^!Left::Send, !jdaal
^!Right::Send, !jdaar
^!Up::Send, !jdaat
^!Down::Send, !jdaab
hotkeyuser1234
Posts: 92
Joined: 07 Mar 2020, 12:27

Re: Shortcut for aligning shapes in PowerPoint

29 Apr 2020, 03:39

Thank you, unfortunately this code does not work. When pressing CTRL+ALT+one of the arrow keys, the forms are resized in the respective direction but not aligned. Maybe could you look at it again?

Thank you for your help!
User avatar
boiler
Posts: 16955
Joined: 21 Dec 2014, 02:44

Re: Shortcut for aligning shapes in PowerPoint

29 Apr 2020, 03:56

It works for me using Microsoft 365 (formerly Office 365). Are you using an older version of PowerPoint?
hotkeyuser1234
Posts: 92
Joined: 07 Mar 2020, 12:27

Re: Shortcut for aligning shapes in PowerPoint

29 Apr 2020, 04:07

I also use PowerPoint with a Microsoft 365 subscription. I just restarted it and now it seems to work but there is some lag until it appears. How can I change it on my own, i.e. how did you come up that it e.g. needs: jdaal for alinging left?

And I can assign this shortcut differently for a different program and it should not be an issue?
User avatar
boiler
Posts: 16955
Joined: 21 Dec 2014, 02:44

Re: Shortcut for aligning shapes in PowerPoint

29 Apr 2020, 04:32

I came up with it by pressing the Alt key, and PowerPoint displays the keyboard shortcut hints. First JD for Shape Format, then AA for Align, then L/R/T/B for which direction to align. What do you mean change it on your own? To assign to different hotkeys? The jdaal, etc., is inherent in PowerPoint, not something you can decide to change.

You can assign the shortcuts differently for other programs by specifying the #IfWinActive directive appropriately.
lblb
Posts: 190
Joined: 30 Sep 2013, 11:31

Re: Shortcut for aligning shapes in PowerPoint

29 Apr 2020, 06:31

Using the COM interface (https://docs.microsoft.com/en-us/office/vba/api/powerpoint.shaperange.align):

Code: Select all

^!right::
ppt := ComObjActive("PowerPoint.Application")
ppt.ActiveWindow.Selection.ShapeRange.Align(2, 0)
Return

^!left::
ppt := ComObjActive("PowerPoint.Application")
ppt.ActiveWindow.Selection.ShapeRange.Align(0, 0)
Return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Araphen, ht55cd3, mamo691 and 363 guests