Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I don't know if this problem is specific to Quicksilver or a general problem with modal windows. I use QS to launch an applescript:

"run 'command' with administrator privileges"

But the modal window from QS to enter my password appears without focus. I can't I need to click on the window with the mouse in order to be able to activate it. I would guess that this is because QS has launched the applescript "in the background" as it were, and already returned focus to the previous app.

Is there a way to switch to this modal window using keyboard actions? It's something I need to do every morning and it's very annoying to have to switch over to it with the mouse every time. I can't command-tab to Quicksilver when the dialog is active.

share|improve this question

2 Answers 2

You can focus SecurityAgent:

osascript -e 'do shell script "ls /var/root" with administrator privileges' &
open -a SecurityAgent

Displaying dialogs:

tell application (path to frontmost application as text)
    --activate
    display dialog "" default answer ""
end tell

⌃F6 (Move focus to the floating window) doesn't work with the password dialogs, and Witch doesn't include them either. You might use a script like this though:

tell application "System Events"
    repeat with p in {"SecurityAgent", "CoreServicesUIAgent", "loginwindow"}
        if exists process p then
            tell process p
                if windows is not {} then
                    set frontmost to true
                    exit repeat
                end if
            end tell
        end if
    end repeat
end tell

CoreServicesUIAgent displays Gatekeeper and quarantine dialogs. loginwindow displays many of the dialogs shown when logging out.

share|improve this answer
    
Thanks for the info. I couldn't get the examples above to work in my script, but they pointed me in the right direction. –  Zac Thompson Jun 24 '13 at 18:21
up vote 0 down vote accepted

The solution was obvious once I saw it: first make Quicksilver the foreground app, then it won't return focus to another app when the script runs.

tell application "Quicksilver" to activate
do shell script "pmset -c displaysleep 180" with administrator privileges
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.