Jump to content
Macro Express Forums

Controlling the Cursor Position in Internet Explorer on Page Load

Recommended Posts

I'm scaling up a small operation and a chronic error is now unacceptable. When IE loads, usually the cursor is in the same position within the particular page, and from that point you can make it go where you want using "tab" and "shift + tab". However, about 20% of the time, the IE Page loads with the cursor "somewhere else", and that screws the whole macro up. It's been like this for at least a year, but now I have to deal with it and fix it.


What I want to do is find a way to get the cursor to a "home" position immediately after the IE page loads, so that it is always starting from a known and predictable position. But I can't get the keyboard to control the cursor in any other way than those I've mentioned. "home" doesn't work, etc...


And the mouse is a bad option because screen position changes from monitor to monitor.


Any help?

Link to comment
Share on other sites

Alt-D will select the address bar, from which you can then tab or shift-tab to your heart's content!


Thanks Paul. That really solved everything. Not only do I have a static and controllable starting point, but I can get to where I'm going within the page with fewer keystrokes (less to go wrong). A solid WIN all the way around. Great answer, and thanks a lot.

Link to comment
Share on other sites

A few caveats about the Alt + D approach...


1. The technique is only really reliable on a newly loaded page. On a page that you have already navigated on, pressing Alt + D will move the cursor to the address line, but when you tab, focus could end up on the most recently visited link instead of the first link. (This behavior may be browser specific).


2. The hotkey may fail on pages that contain non-W3C technologies such as Flash and PDF. (JavaScript and Ajax can also throw things for a loop.)


3. The number of times that you must tab after pressing Alt + D to reach the first link is a function of how the browser is configured. For example, if you have toolbars between the address line and the active window, you may have to press the tab key several times to navigate through the toolbars. Add-ins, configuration settings, etc. can also affect the number of tabs.


4. Under ideal conditions, there is no need to insert a delay between the tabs. But on some pages, tab-key navigation is unpredictable without a short delay between each simulated keypress. I have noticed this most often on pages that are heavy with JavaScript.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...