0

I've been trying to find a way to automate the process of clicking the "Ignore" button on the "unreadable disk" dialogue that appears when an unrecognized disk is connected to a Mac running macOS 12 or newer:

ignore dialogue

(In this case I have some drives that I need to ignore due to using them in another way with a virtual machine.)

My goal is to prevent manual intervention each time this dialog appears (on reboot) and have the "Ignore" button clicked automatically.

I've attempted to use AppleScript and System Events to target the specific dialogues and button, but so far, I've been unsuccessful in detecting the dialog and interacting with it. It seems that the unreadable disk dialogue is not accessible through the standard AppleScript/System Events methods.

Here's what I've tried so far:

  1. Using AppleScript to target windows and buttons within the Finder process:
tell application "System Events"
    tell process "Finder"
        set allWindows to every window
        repeat with currentWindow in allWindows
            set windowName to name of currentWindow as string
            log "Window: " & windowName
            set allButtons to every button of currentWindow
            repeat with currentButton in allButtons
                log "    Button: " & name of currentButton
            end repeat
        end repeat
    end tell
end tell
  1. Using AppleScript to target dialogues and buttons within the Finder process:
tell application "System Events"
    tell process "Finder"
        set allUIElements to every UI element
        repeat with currentUIElement in allUIElements
            set elementType to role of currentUIElement as string
            set elementName to name of currentUIElement as string
            log "UI Element: " & elementType & " - " & elementName
            if elementType is "AXDialog" then
                set allButtons to every button of currentUIElement
                repeat with currentButton in allButtons
                    log "    Button: " & name of currentButton
                end repeat
            end if
        end repeat
    end tell
end tell
  1. Using AppleScript to target UI elements with specific roles, such as "AXWindow", within the Finder process:
tell application "System Events"
    tell process "Finder"
        set allUIElements to every UI element
        repeat with currentUIElement in allUIElements
            set elementType to role of currentUIElement as string
            set elementName to name of currentUIElement as string
            log "UI Element: " & elementType & " - " & elementName
            if elementType is "AXWindow" then
                set allButtons to every button of currentUIElement
                repeat with currentButton in allButtons
                    log "    Button: " & name of currentButton
                end repeat
            end if
        end repeat
    end tell
end tell

None of these approaches have successfully detected the unreadable disk dialogue(s) or allowed me to interact with the "Ignore" button.

I would appreciate any suggestions or insights on how to automate both the process of identifying the appropriate window and button and the actual process of clicking the "Ignore" button.

Are there alternative methods or tools that you would recommend? Has anyone encountered a similar issue and found a solution?

5
  • What makes you think that those are finder windows? There are numerous questions around this issue that it might be worth looking into. Here are a couple to get you started: apple.stackexchange.com/q/40436/211401 and apple.stackexchange.com/q/340942/211401.
    – Mockman
    Commented Apr 22, 2023 at 21:48
  • As a quick and dirty alternative… first find out the x-y coordinates of a point within the dialogue. A simple way to do that is to type command-shift-4 and move the cursor to some place over the dialogue and make note of the coordinates. Then put something like this in a script: tell application "System Events" to click at {230, 400} and it should return some info you can use in your script. I don't run your OS so I'll leave it at that but hopefully this gives you something.
    – Mockman
    Commented Apr 22, 2023 at 21:54
  • 2
    Are they the same drives each time, or a series of similar but different drives? If the same, you could tell fstab to not mount them.
    – Tetsujin
    Commented Apr 23, 2023 at 7:07
  • @Mockman - the quick & dirty isn't going to work, because each one will be offset from the last.
    – Tetsujin
    Commented Apr 24, 2023 at 18:21
  • @Tetsujin that's a good idea to try. I'll see if I can set that up here when I'm back at the server.
    – ylluminate
    Commented Apr 28, 2023 at 22:57

0

You must log in to answer this question.

Browse other questions tagged .