1

I have an AutoHotkey script which navigates various pages on a website by URL. Every time I want to open a new page I use the Run command, which opens a new instance of Internet Explorer.

By the time my script finishes running, I typically have 5 or 6 different windows open just to navigate a website.

How do I open a webpage in Autohotkey without creating a new window?

^j::
  Run, iexplore.exe www.example.com/login, , Max
  doStuff1()
  Run, iexplore.exe www.example.com/settings, , Max
  doStuff2()
  Run, iexplore.exe www.example.com/wp-admin, , Max
  doStuff3()
  // doStuff4(), doStuff5(), etc.
return
Stevoisiak
  • 23,794
  • 27
  • 122
  • 225

1 Answers1

1

Instead of using the Run command, you could Send the keystrokes necessary to change the URL (or open a new tab if that's what you prefer).

After you've confirmed your iexplore.exe has started:

WinGetActiveTitle, Curwtt               ; Get title of active window

When you're ready to change URL:

WinActivate, %Curwtt%                   ; Ensure we are on original window
Send, !d                                ; Alt-D places cursor in URL field
Send, http://blahblahblah.com{Enter}    ; Go to the new web site
; Dostuff()
  • [According to tumchaaditya](https://stackoverflow.com/a/10241473/3357935), you can also use F6 to toggle focus on the URL field. – Stevoisiak Sep 22 '17 at 18:43