thgdfhfghffg

Q: keynote GUI script

Hi,

 

I've been trying to automatize some actions in Keynote with Apple Script with recycling some script obtained here :-p (thanks again!), but I'm encountering difficulties.

 

The following script does not behave as I would expect:

 

tell application "Keynote"

    activate

    set N1 to count the slides of document 1

end tell

 

tell application "System Events"

    click menu item "First Slide" of menu 1 of menu item "Go To" of menu 1 of menu bar item "Slide" of menu bar 1 of process "Keynote"

end tell

 

tell application "System Events" to click menu item "Show Presenter Notes" of menu 1 of menu bar item "View" of menu bar 1 of process "Keynote"

 

repeat N1 times

    tell application "System Events"

       click menu item "Expand" of menu 1 of menu bar item "Slide" of menu bar 1 of process "Keynote"

       click menu item "Next Slide" of menu 1 of menu item "Go To" of menu 1 of menu bar item "Slide" of menu bar 1 of process "Keynote"

    end tell

end repeat

 

The 2 issues are:

- The Expand command only works if I select manually the first slide.

- absolutely nothing happens when i try to "Show Presenters Notes"

 

Any idea?

Thanks in advance,

Cheers,

David

OS X Yosemite (10.10.3)

Posted on May 31, 2016 9:05 AM

Close

Q: keynote GUI script

  • All replies
  • Helpful answers

  • by Pierre L.,

    Pierre L. Pierre L. May 31, 2016 4:57 PM in response to thgdfhfghffg
    Level 5 (4,484 points)
    May 31, 2016 4:57 PM in response to thgdfhfghffg

    The following script seems to work as expected under OS X “El Capitan” 10.11.3:

     

    tell application "Keynote"

         activate

         set N1 to count the slides of document 1

    end tell

     

    tell application "System Events" to tell menu bar 1 of process "Keynote"

         click menu item "First Slide" of menu 1 of menu item "Go To" of menu 1 of menu bar item "Slide"

         tell menu item "Show Presenter Notes" of menu 1 of menu bar item "View"

               if exists then click

         end tell

         repeat N1 times

               tell menu 1 of menu bar item "Slide"

                     if enabled of menu item "Expand" then click menu item "Expand"

                     click menu item "Next Slide" of menu 1 of menu item "Go To"

               end tell

         end repeat

    end tell