Search code examples
scriptinghotkeysautohotkey

AHK: How to read text from a Pop-up window/Dialog Box?


I would like to read the text of a Dialog Box/ Pop-up window and then compare the text of that window to some value. Based on the comparison, I would like to take some action.

Is there a way to read the text of a Dialog Box/ Pop-up window, using AHK scripts?

Thanks Sunny


Solution

  • Like Robert said, on some messagebox dialogs you can press Ctrl+C to copy its contents to the clipboard.

    Otherwise you can use the WinGetText command like so:

    WinGetText, output, My Window's Title
    msgbox The text in the window is:`n%output%