[
    {
        "role": "user",
        "content": "How%20can%20I%20setup%20a%20hotkey%20that%20will%20open%20a%20highlighted%20url%20or%20news%20link%20in%20Edge%20and%20automatically%20go%20into%20read%20to%20you%20mode%3F"
    },
    {
        "role": "assistant",
        "content": "You can get very close to what you're asking (select a URL or news link \u2192 open it in Edge \u2192 then start Read Aloud mode) by combining Microsoft Edge\u2019s built-in keyboard shortcuts with a bit of automation using something like AutoHotkey (on Windows). Edge doesn\u2019t have a single built-in hotkey that exactly does all that, but you can stitch together behavior that works well. Here\u2019s how.\n\n---\n\n## What Edge already provides\n\nHere are the Edge keyboard shortcuts related to \u201cRead Aloud\u201d and \u201cReading/Immersive Reader\u201d modes:\n\n- **Ctrl + Shift + U** \u2014 starts or stops Read Aloud for the current webpage. ([support.microsoft.com](https://support.microsoft.com/en-us/edge/keyboard-shortcuts-in-microsoft-edge?utm_source=openai))  \n- **F9** \u2014 toggles Immersive Reader (Reading Mode) when it's supported on the page. ([support.microsoft.com](https://support.microsoft.com/en-us/edge/use-immersive-reader-in-microsoft-edge?utm_source=openai))  \n\nSo, once you have the URL open in Edge, pressing `Ctrl+Shift+U` will begin reading aloud right away.\n\n---\n\n## Automating \u201cselect a URL \u2192 open in Edge \u2192 start Read Aloud\u201d\n\nTo combine all steps into one hotkey, you can use **AutoHotkey** (on Windows). Below is a conceptual outline + sample script to do what you want, with some tweaks you may need.\n\n### What the script will do\n\n1. When you trigger a hotkey (e.g. `Win+Alt+R`), copy the currently selected text (which you pre-highlight; ideally it's a URL or link).\n2. Open that URL in Microsoft Edge (in a new tab).\n3. Wait a little for the page to load, then send `Ctrl+Shift+U` to start Read Aloud.\n\n### Sample AutoHotkey script\n\n```autohotkey\n; -- ensure script uses v1 syntax or adapt to v2 accordingly\n#NoEnv\nSendMode Input\nSetWorkingDir %A_ScriptDir%\n\n; Define the hotkey. You can pick something you like.\n; This uses Win+Alt+R as an example.\n#!r::\n    ; Clear clipboard, then copy selected text\n    ClipSaved := ClipboardAll\n    Clipboard := \"\"\n    Send ^c\n    ClipWait, 0.5\n    if (ErrorLevel) {\n        MsgBox, 48, Error, Could not get highlighted text.\n        Clipboard := ClipSaved\n        Return\n    }\n    url := Trim(Clipboard)\n\n    ; Check if it looks like a URL (basic check, you can improve)\n    if !(url ~= \"^(https?://)\") {\n        url := \"http://\" . url\n    }\n\n    ; Open Edge with that URL\n    Run, msedge.exe \"%url%\"\n\n    ; Give Edge time to launch and load content \u2014 adjust this Delay as needed\n    Sleep, 2000\n\n    ; Send keyboard shortcut to start Read Aloud\n    WinActivate, ahk_exe msedge.exe\n    Send ^+u\n\n    ; Restore old clipboard (optional)\n    Clipboard := ClipSaved\nReturn\n```\n\n### What to adjust/tune\n\n- **Hotkey combo**: `#!r` means *Win + Alt + R*. You can pick something else to avoid conflicts.\n- **Clipboard delay** (`ClipWait`) may need adjustment if text selection is slow or on large pages.\n- **Search for link vs text**: If the highlighted text isn\u2019t a proper URL, you might want to detect that and skip the Read Aloud or show a warning.\n- **Delay after launching Edge**: the `Sleep, 2000` (2 seconds) may or may not be enough for a given page; you may need longer.\n\n---\n\n## Limitations & considerations\n\n- If the selection isn\u2019t a URL (e.g. you highlighted a headline or summary), it may not work cleanly.\n- Edge sometimes takes a moment to fully load UI elements, so Read Aloud button might not be active immediately. The script\u2019s timing (the delay) is key.\n- If Edge is already open with many tabs and windows, the script may open in an unexpected window or tab.\n\n---\n\n## Summary: Recommended workflow\n\nUntil Microsoft adds a built-in single hotkey to cover all steps, here\u2019s a workflow that works:\n\n1. Highlight the URL or link text (e.g. in any app, browser, document).\n2. Press your AutoHotkey hotkey (e.g. `Win + Alt + R` from the sample).\n3. Edge should open the highlighted URL and then start Read Aloud.\n\nIf you want, I can send you a ready-made AutoHotkey script customized for your preferences (hotkey choice, delays, etc.). Do you want me to build and test one for you?"
    },
    {
        "role": "user",
        "content": "Yes%2C%20please%20use%20alt%20control%20r%20as%20the%20hotkey."
    },
    {
        "role": "assistant",
        "content": "Here\u2019s a refined AutoHotkey script that uses **Ctrl + Alt + R** as the hotkey. It\u2019ll:\n\n1. Copy the currently selected/highlighted text (you should highlight the URL or link),\n2. Open that URL in Microsoft Edge,\n3. Once Edge is active, send **F9** to enter Immersive Reader/Reading mode (if supported),\n4. Then send **Ctrl + Shift + U** to start Read Aloud.  \n\nBelow are the keyboard shortcut references, followed by the script itself. You can adjust timing delays if necessary.\n\n---\n\n## Key Edge Shortcuts\n\n- F9 \u2014 Enter or exit Immersive Reader / Reading mode. ([support.microsoft.com](https://support.microsoft.com/en-us/edge/keyboard-shortcuts-in-microsoft-edge?utm_source=openai))  \n- Ctrl + Shift + U \u2014 Start or stop Read Aloud. ([support.microsoft.com](https://support.microsoft.com/en-us/edge/keyboard-shortcuts-in-microsoft-edge?utm_source=openai))  \n\n---\n\n## AutoHotkey Script (using Ctrl + Alt + R)\n\n```autohotkey\n; -----------------------------------------\n; Script: Open highlighted URL in Edge, then enter Immersive Reader & start Read Aloud\n; Hotkey: Ctrl + Alt + R\n; -----------------------------------------\n\n#NoEnv\nSendMode Input\nSetWorkingDir %A_ScriptDir%\n\n^!r::  ; Ctrl + Alt + R\n    ; Save existing clipboard\n    ClipSaved := ClipboardAll\n    Clipboard := \"\"  ; empty clipboard\n\n    ; Copy selected text\n    Send, ^c\n    ClipWait, 0.5\n    if (ErrorLevel) {\n        MsgBox, 48, Error, Could not get highlighted text.\n        Clipboard := ClipSaved\n        Return\n    }\n\n    url := Trim(Clipboard)\n\n    ; Basic check: does it start with http:// or https:// or maybe \u201cwww.\u201d?\n    if !(url ~= \"^(https?://)\") {\n        if (url ~= \"^www\\.\")\n            url := \"http://\" . url\n        else {\n            ; Not a URL \u2014 restore clipboard and abort\n            MsgBox, 48, Error, Selected text doesn\u2019t appear to be a URL.\n            Clipboard := ClipSaved\n            Return\n        }\n    }\n\n    ; Open Edge with that URL\n    Run, msedge.exe \"%url%\"\n    ; Optional: If you want a new window rather than a tab, you could use command-line flags.\n    ; e.g., Run, msedge.exe --new-window \"%url%\"\n\n    ; Wait for Edge to open and load page\n    Sleep, 2500  ; 2.5 seconds; increase if pages are slow\n\n    ; Make Edge active\n    WinActivate, ahk_exe msedge.exe\n    ; Wait a moment just to ensure window is active\n    Sleep, 300\n\n    ; Send F9 to enter Reading / Immersive Reader mode (if supported)\n    Send, {F9}\n    Sleep, 300  ; short pause\n\n    ; Send Ctrl+Shift+U to start Read Aloud\n    Send, ^+u\n\n    ; Restore clipboard\n    Clipboard := ClipSaved\nReturn\n```\n\n---\n\n## How to Install & Use\n\n1. Download and install **AutoHotkey** from https://www.autohotkey.com/  \n2. Save the above script as a `.ahk` file (e.g. `EdgeReadAloud.ahk`).\n3. Run the script (double-click the file) to activate it.\n4. Highlight a URL or a link somewhere (browser, document, etc.).\n5. Press **Ctrl + Alt + R**. Edge should open that URL, go into Immersive Reader if possible, and then start Read Aloud automatically.\n6. If a step fails (for example, the page doesn\u2019t support Immersive Reader, or the URL isn\u2019t valid), you may need to adjust or skip some steps.\n\n---\n\n## Tweaks & Debugging\n\n- **Adjust sleep times** (`Sleep, 2500` etc.) if pages load slowly or your system is busy.\n- If Immersive Reader isn\u2019t supported on a page, F9 may do nothing; Read Aloud (`Ctrl + Shift + U`) might still work in the \u201cnormal\u201d view.\n- If you don\u2019t want Immersive Reader, you can remove the `Send, {F9}` line.\n- If Edge is already running and you want to open in a new tab vs new window, you can use flags like `--new-tab` or use `start msedge` depending on your version.\n\n---\n\nIf you like, I can also share you a version with error checking/logging (so you can detect if Immersive Reader isn\u2019t available for a page) or one that tries to force \u201cread:\u201d prefix where needed. Do you want that?"
    }
]