Jump to content
Sign in to follow this  

Get URL from Chrome Window

Recommended Posts

I have AutoHotkey set to run a vbscript file on a hotkey. The script is as follows:

Set aut = CreateObject("AutoItX3.Control")
aut.AutoItSetOption "WinTitleMatchMode",2

list = aut.WinList("Google Chrome","")

if ubound(list,2) = 1 Then

    title = list(0,1) : Wscript.Echo title

    aut.WinActivate title,""
    aut.WinWaitActive title,"",5
    aut.Send "{!}d",0
    aut.Sleep 100
    aut.Send "{^}c",0
    url = aut.clipget : Wscript.Echo url

    Wscript.Echo "Chrome not active"

end if

The value of `title` indicates that the correct window is being identified. I would expect the first `send` (alt-d) to select the text in the address bar and the second `send` (ctrl-c) to copy that text to the clipboard. It does not do that and I have no idea why. What gets displayed is whatever was in the clipboard (if anything) prior to running the script. Any suggestions would be appreciated.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...