Share via

Getting details of shapes inside a group shape

Anonymous
2023-06-22T14:56:37+00:00

Hello, I am using apple script to access the shapes that are present in a group shape in powerpoint.

This is my script:
set slideList to {}

set shapeList to {}

set fo to {}

tell application "Microsoft PowerPoint"

if running then

if active presentation is not missing value then

set activePresentation to active presentation

set slideCount to count of slides of activePresentation

set end of slideList to slideCount

repeat with i from 1 to slideCount

set currentSlide to slide i of activePresentation

set slideName to name of currentSlide

set end of slideList to slideName

set shapeCount to count of shapes of currentSlide

set end of shapeList to shapeCount

repeat with j from 1 to shapeCount

-- Get the shape object

set currentShape to shape j of currentSlide

-- set shapeName to name of currentShape

set end of shapeList to currentShape

set t to shape type of currentShape

set co to count of shapes of currentShape

log co

repeat with kk from 0 to co

log "bla"

log item kk

set end of fo to item kk of shapes of currentShape

end repeat

-- Change shape type to diamond

--set auto shape type of currentShape to 5

--set left position of currentShape to 0

end repeat

end repeat

else

display dialog "There is no active presentation."

end if

else

display dialog "PowerPoint is not running."

end if

end tell

return {shapeList, fo}

But I am getting: {{1, shape 1 of slide 1 of active presentation of application "Microsoft PowerPoint"}, {,,,,}}
This shows that I am reading the count of shapes in group shape correctly but can not access each shape.

Microsoft 365 and Office | PowerPoint | For business | MacOS

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Steve Rindsberg 99,161 Reputation points MVP Volunteer Moderator
    2023-06-23T15:04:31+00:00

    In case you haven't seen these, here is an online version of Paul Berkowitz's book about converting VBA to AppleScript:

    Moving from Microsoft Office VBA to AppleScript

    That thing's got some long legs!

    MacTech commissioned that to get out front of the issues that'd arise when people "upgraded" to Office 2008/Mac and found ... Wait! WHAT??? ... that there was no VBA.

    Paul was a Word MVP on the Mac side; he called on a couple of us from The Dark Side to supply Word/Excel/PowerPoint VBA examples for him to translate into AppleScript. One VERY smart fella, Paul.

    Was this answer helpful?

    0 comments No comments
  2. John Korchok 232.4K Reputation points Volunteer Moderator
    2023-06-23T12:58:03+00:00

    There isn't anyone here who's an AppleScript expert, but grouped shapes are manipulated in VBA as an array. So your script would probably have to first identify whether a shape was a group, then use an additional repeat with subroutine to identify each shape within the group.

    In case you haven't seen these, here is an online version of Paul Berkowitz's book about converting VBA to AppleScript:

    Moving from Microsoft Office VBA to AppleScript

    Here's my page of downloads, where you can get the Microsoft Office AppleScript documentation:

    Downloads

    Was this answer helpful?

    0 comments No comments