Skip navigation

applescript: dialog button (spacebar activates)

683 Views 12 Replies Latest reply: Mar 8, 2013 7:34 PM by softwater RSS
softwater Level 5 Level 5 (5,370 points)
Currently Being Moderated
Mar 8, 2013 5:53 AM

Friends

 

I know how to specify the default button (return/enter activates) for a display dialog box, but I can't find anywhere in my documentation sources that gives a way to specify the button that is activated by spacebar (see screenshot). Possibly because I don't even know what to call it — 'secondary default button', perhaps?

 

Does anyone know what the applescript command is for this setting?

 

Screen Shot 2013-03-08 at 20.45.44.png

OS X Mountain Lion (10.8.2)
  • twtwtw Level 5 Level 5 (4,580 points)
    Currently Being Moderated
    Mar 8, 2013 6:53 AM (in response to softwater)

    That's the focused item, and there's no way to set it from applescript that I know of.  The focused item is the one that first catches keyboard events.  The return key is automatically routed to the default button, but the space key acts like a click on the focused item (unless it's an editable text field), and the tab key moves the focus to the next item.

  • Frank Caggiano Level 7 Level 7 (22,760 points)
    Currently Being Moderated
    Mar 8, 2013 7:37 AM (in response to softwater)

    This is not an idiom I believe I have ever seen. In what apps did you see this?

     

    The default button by definition has the focus. The default button has to have the focus as that is what is returned  if noting is specifically chosen.

     

    Is what you are looking for is that one button is run if the return key is pressed but if the space bar is pressed another button is selected? Spacebar by itself doesn't not normally dismiss a dialog.

  • Frank Caggiano Level 7 Level 7 (22,760 points)
    Currently Being Moderated
    Mar 8, 2013 8:01 AM (in response to softwater)

    The dialog Finder presets to me doesn't have a default set

    Screen Shot 2013-03-08 at 10.59.29.png

    So in your example what happens if I press return?

  • twtwtw Level 5 Level 5 (4,580 points)
    Currently Being Moderated
    Mar 8, 2013 8:05 AM (in response to softwater)

    In cocoa you would make the button the panel's first responder using something like [window makeFirstResponder:button].  I'm out of practice with ASOC, though, so I'll have to think about how to implement that. 

  • Frank Caggiano Level 7 Level 7 (22,760 points)
    Currently Being Moderated
    Mar 8, 2013 9:15 AM (in response to softwater)

    I still don't understand how this works.

     

    Again the default button is returned when I hit return if I don't select an other button first. What does this other 'selected' button do? How is it selected and returned?

     

    I'm really interested. I just cannot see what the use of this is if it is even doable.

     

    thanks

  • Frank Caggiano Level 7 Level 7 (22,760 points)
    Currently Being Moderated
    Mar 8, 2013 9:32 AM (in response to softwater)

    Ok tried a folder copy and the dialog I get is

     

    Screen Shot 2013-03-08 at 12.27.07.png

    Not even a choince to keep both. And looking at your first example what is the difference between Don't Replace and Stop?

     

    Doesn't Don't Replace just keep both (in your example) ?

     

    I got to be missing something really basic here.

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.