Consulting

Results 1 to 2 of 2

Thread: Making Compress Pictures Dialogue Box Selections in Mac

  1. #1

    Question Making Compress Pictures Dialogue Box Selections in Mac

    Hi,

    I have code that in PC:
    1. automatically initiates the 'compress pictures' dialogue box
    2. changes default selections in that dialogue box
    3. runs compress pictures

    Step 1 works in mac, steps 2 and 3 use SendKeys, which needs another solution.

    I saw another post that provided in great detail how you can use MacScript in VBA to replicate SendKeys functionality in Mac. I think I can figure that part out.

    My Question is: Is it even possible to use hotkeys/the keyboard to navigate the 'compress pictures' dialogue box in Mac PPT, and change default selections?
    Other than hitting enter to run it (which DOES work), any attempt to tab through, move up and down, or otherwise select/change one of the radio buttons or dropdowns has failed. That's when attempting to change these settings manually (with just the keyboard). If I can't navigate and change selections in the dialogue box using the keyboard in Mac, then it doesn't matter whether or not there is a SendKeys workaround.


    The Compress Dialogue boxes for PC and Mac PPT office 360 are pictured below.
    In Mac, I would need to use keyboard to navigate and specify selections for each of the indicated sections (dropdown list, checkboxes, radio buttons)





    compressorstart:
    opic.Select 'From earlier part of the code - ensures that some shape that is an mso picture (or placeholder) is selected prior to running
    CommandBars.ExecuteMso ("PicturesCompress")
    SendKeys "%{u}" 'chooses "Use Default Resolution" radio button
    SendKeys "a-" 'force unchecks "Apply Only To This Picture" checkbox
    SendKeys "{ENTER}" 'Run it
    End Sub

    Compress Pictures Dialogue Box PC.jpg

  2. #2
    I have resolved part of this. It requires a mac user to one-time go to System Preferences >> Keyboard >> Shortcuts >> and Check the "Use Keyboard Navigation" box to enable tab, arrow scrolling in dialog boxes.

    There is an issue. If the Compress Pictures dialog box is already open, and this code is then run from Apple Script Editor, it works. However, if it is ALL done in vba (open the compress pictures dialog box via CommandBars.ExecuteMso ("PicturesCompress"), then run this macscript, the macscript will not execute until the dialog box has been closed.

    If there is a solution, it is appending this code to open the compress pictures dialog box using macscript, instead of commandbars.executemso("PicturesCompress"). Still investigating, will update if I figure it out.

    If anyone has macscript that succeafully interacts with/clicks on things from the ribbon, any help would still be appreciated!

    MacScript version. (this code would run after some arbitrary picture in the deck was clicked on. Does NOT work because the macscript will not execute until the dialog box is closed.

    The raw apple script is below that. If you run that from script editor after opening the compress pictures dialog box, it works.



    Dim MacCompressionExec As String
    MacCompressionExec = "tell application ""System Events""" & vbNewLine & _
    "tell process ""Microsoft PowerPoint""" & vbNewLine & _
    "set frontmost to true" & vbNewLine & _
    "key code 125 #Down Arrow - Open Picture Qualiy Dropdown " & vbNewLine & _
    "key code 14 #E - Email, in case Print (P) and Use Original Quality (U) Are Unavailable" & vbNewLine & _
    "delay 1 #Can't select again for half a sec or so" & vbNewLine & _
    "key code 35 #P - Print, in case Use Original Quality is Unavailable" & vbNewLine & _
    "delay 1" & vbNewLine & _
    "key code 32 #U - Use Original Quality" & vbNewLine & _
    "key code 36 #Enter - Select option from Picture Quality dropdown" & vbNewLine & _
    "key code 48 #tab" & vbNewLine & _
    "key code 48 #tab - tab twice to radio buttons" & vbNewLine & _
    "delay 1" & vbNewLine & _
    "key code 126 #Up Arrow - All Pictures is always the top option, does not cycle back once at top" & vbNewLine & _
    "delay 1" & vbNewLine & _
    "#key code 36 #Enter to run" & vbNewLine & _
    "#return ""Done""" & vbNewLine & _
    "end tell" & vbNewLine & _
    "end tell"
    CommandBars.ExecuteMso ("PicturesCompress")
    MacScript (MacCompressionExec) 'Doesn't work because you have to close dialog box before it will run••••ˇˇˇˇ


    AppleScript

    tell application "System Events"
    tell process "Microsoft PowerPoint"
    set frontmost to true
    key code 125 #Down Arrow - Open Picture Qualiy Dropdown
    key code 14 #E - Email, in case Print (P) and Use Original Quality (U) Are Unavailable
    delay 1 #Can't select again for half a sec or so
    key code 35 #P - Print, in case Use Original Quality is Unavailable
    delay 1
    key code 32 #U - Use Original Quality
    key code 36 #Enter - Select option from Picture Quality dropdown
    key code 48 #tab
    key code 48 #tab - tab twice to radio buttons
    delay 1
    key code 126 #Up Arrow - 'All Pictures' is always the top option, does not cycle back once at top
    delay 1
    key code 36 #Enter to run
    end tell
    #end tell
    end tell

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •