Sign in to follow this  
Followers 0
Alterlife

Getting the current chrome url.

2 posts in this topic

I have a chrome window open. I need to be able to attach to it and get the current URL being browsed, I also need to be able redirect the browser to another URL.

How would I go about doing this?

Share this post


Link to post
Share on other sites



Success :-)

AutoItSetOption("WinTitleMatchMode", 2)

$handle = WinGetHandle("[CLASS:Chrome_WindowImpl_0; TITLE:Getting the current chrome url]")

If @error Then
    MsgBox(4096, "Error", "Could not find the correct window")
Else
    ; alert the present url
    MsgBox(4096, "", ControlgetText($handle, "", "Chrome_AutocompleteEditView1" ))

    ;n redirect the browser
    ControlSetText ($handle, "", "Chrome_AutocompleteEditView1", "http://alterlife.org/")
    ControlSend ($handle, "", "Chrome_AutocompleteEditView1", "{enter}")
    MsgBox(4096, "Error", "The browser has been redirected to http://alterlife.org/.")
EndIf
1 person likes this

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  
Followers 0