Creating a keyboard shortcut

Discussion in 'OS X Yosemite (10.10)' started by Forkjulle, Aug 15, 2015.

  1. Forkjulle macrumors regular

    Joined:
    Aug 1, 2012
    #1
    See where it says "export"?

    There is no keyboard shortcut. Is there a way that I can create a keyboard shortcut for it?
     

    Attached Files:

  2. brookter1 macrumors member

    Joined:
    Aug 5, 2015
    #2
    If that's Preview you're using, then I've just spent 10 minutes trying it out and I can't get it work either, even using Apple's own documentation for shortcuts with 3 dots (which works fine in other programs...).

    It seems like it may be a longstanding bug in Preview: https://discussions.apple.com/thread/3203931?start=15&tstart=0
     
  3. Forkjulle thread starter macrumors regular

    Joined:
    Aug 1, 2012
  4. Partron22 macrumors 68000

    Partron22

    Joined:
    Apr 13, 2011
    Location:
    Yes
    #4
    This AppleScript works to bring up Preview's export dialog:
    Code:
    tell application "Preview" to activate
    delay 1
    tell application "System Events"
        click menu item "Export…" of menu "File" of menu bar item "File" of menu bar 1 of application process "Preview"
    end tell
    
    Save it as an Automator script and assign your keyboard shortcut to that.
     
  5. campyguy macrumors 68030

    Joined:
    Mar 21, 2014
    Location:
    Portland / Seattle
    #5
    FYI, it's not "3 dots/periods" - it's an ellipsis, inserted by pressing "Option-semicolon" on your keyboard. I got my tech writing degree in 1988, so that's how I knew what an ellipsis is - it represents an implied "there's more to follow"…

    System Preferences > Keyboard > Shortcuts Tab > App Shortcuts item > click "+" > choose "Preview" from the Applications menu > type in the menu item exactly as you see it - Export… (or Export then Option-semicolon, with no spaces) > and type in your preferred Keyboard Shortcut > Press the Add button.

    You're done - you don't even need to restart or log out.

    Make sure you check for Command conflicts. Keep in mind that some applications don't work properly, like Firefox, which only responds to its own built-in commands - Shortcuts may show up but won't work and you'd need to resort to using your mouse or built-in command structure.

    FYI, you can also use System Commands. I use "Command-P" in "All Applications" to invoke the Print Dialog, and while in that Print Dialog Box press my Keyboard Shortcut "Command-P" to invoke the "Save as PDF…" Command that's in the pull-down menu. So, you're not just limited to the visible commands.
     
  6. Partron22 macrumors 68000

    Partron22

    Joined:
    Apr 13, 2011
    Location:
    Yes
    #6
    True, however AppleScript interpreter has trouble recognizing actual ellipses …, and converts three periods... into an ellipses when sending messages to a menu item.
    Yes, that's odd, and I'm not sure which format "Keyboard Shortcuts" or "Services Preferences" takes, but if one form does not work, you'd best try the other as well.
     
  7. campyguy macrumors 68030

    Joined:
    Mar 21, 2014
    Location:
    Portland / Seattle
    #7
    A non-issue for me. I don't need Automator to accomplish this - and I've been using Apple's built-in editor since Tiger. No Automator required for this very simple edit - 90 seconds, done. QED.

    Automator is overkill for what the OP wants to accomplish with the Preview app. I simply choose to use one of Apple's other tools to address this, and it's so much faster… And, if the app's developer - in this specific case, Apple, adheres to programming convention - and Preview does, then an ellipsis will work. I am being case- and post-specific, and I have used and don't shy away from Automator. Cheers!
     
  8. brookter1 macrumors member

    Joined:
    Aug 5, 2015
    #8


    It's a bug in Preview.

    Try this:

    a) Create a short cut in System Preferences under Preview for Export… (ellipsis).
    b) Look in the Preview File menu -- no shortcut next to the Export… item.
    c) Go back to System Preferences and recreate the identical menu item shortcut but this time in 'All Applications'. Copy and paste the name to be sure.
    d) Look in the Preview File menu -- there's the shortcut.
    e) Go back to System Preferences, delete it under All Applications, recreate under Preview
    f) .... gone again

    So there's a bug in Preview with application specific shortcuts. I posted a link to a discussion of this earlier on in the thread.
     
  9. Partron22 macrumors 68000

    Partron22

    Joined:
    Apr 13, 2011
    Location:
    Yes
    #9
    I think it's likely a feature instead. You have to go to some trouble to make menus behave this badly via Xcode.
     
  10. campyguy macrumors 68030

    Joined:
    Mar 21, 2014
    Location:
    Portland / Seattle
    #10
    Odd, I have the "Control-Option-Command" shortcut assigned to that command on one of the Macs we use for managing printers and also a 2012 rMBP we use for field work. But both of those Macs were upgraded - not with a clean install - from Mavericks, when those tweaks were made. I tried it out on two Macs that were straight up with Yosemite - it seems as though some commands under the File Menu aren't editable under app-specific keyboard shortcuts. So, in that regard, my bad, and thanks for pointing that out…

    Odd that those in that thread had issues in Mavericks and we didn't here…
     
  11. brookter1 macrumors member

    Joined:
    Aug 5, 2015
    #11
    No problem... It is very odd. Suspicion that it's to do with sandboxing -- did that come in after Mavericks?
     
  12. campyguy macrumors 68030

    Joined:
    Mar 21, 2014
    Location:
    Portland / Seattle
    #12
    From what I've read and experienced, Yosemite was where the real sandboxing was put into effect, although the screws were being tightened in Mavericks. One that 2012 rMB and on mine, Firefox is installed and I use "Control-Z" to invoke the WIndow>Zoom command - it's in the "All Applications" Shortcuts option. It shows up in all applications on both rMBP and works for FF on my 2012 Mac but shows up and doesn't work on my Yosemite-only Mac - I have to navigate to/click on FF's Window>Zoom Command (with the ^Z right next to it). Grrr, that.

    I use two displays that are attached to my rMBP and move windows between displays - the rMBPs and one each portrait and landscape, resizing windows with that command (and Control-Z for MS Office's "Zoom Window" command). Mavericks seems more "user friendly" with interface changes than Yosemite, and I haven't tried tweaking that OS yet.

    Yeah, I share your suspicion there.
     
  13. Partron22 macrumors 68000

    Partron22

    Joined:
    Apr 13, 2011
    Location:
    Yes
    #13
    Oh yes, sandboxing. The script I used, which I wrote yesterday on 10.10.4, works, but I have "Script Editor allowed to control Mac" checked under Security prefs. Likely, if the Script is saved as an App, you'll have to add it to the Security prefs allowed list as well.
     

Share This Page