Jump to content

How to move mouse to current cursor position?


Recommended Posts

This seems like such an elementary question that I can't believe I'm asking this, but I've searched the forums and help docs and could not find an answer.

Here's the scenario: I have sent the Tab key several times, and an icon is now highlighted. Here's the issue: I need to move the mouse to that icon (i.e. the current cursor position). When I write tests to take this action on just one machine, I simply get the coordinates of the icon and use that. But I now need to run this test on many machines, of all different resolutions, so that will not work.

Any ideas?

Link to comment
Share on other sites

Is this a browser, or window app. I'd stick with the control*/_IE* functions rather than tabs to move between controls.

controlgetfocus to return the focused control

$oIE.activeelement to return the focused browser control...where $oIE is the dom object from _IEcreate

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

Is this a browser, or window app. I'd stick with the control*/_IE* functions rather than tabs to move between controls.

controlgetfocus to return the focused control

$oIE.activeelement to return the focused browser control...where $oIE is the dom object from _IEcreate

It's the Windows 8 Search screen...the source of all my woes, heh. Essentially the issue here is that I need to be able to right-click on an icon so I can run an application as administrator.

Link to comment
Share on other sites

throw this at the top of your script:

#RequireAdmin

and then run through the run()

Thank you so much :)!

My one issue now: is there any way to bypass the UAC prompt that occurs here? AutoIt seems to get suspended when the UAC prompt appears, and so I have to manually select "Yes" to allow AutoIt to execute the script.

Link to comment
Share on other sites

You can create a scheduled task, and run it as highest priority...then you can execute with cmd line

schtasks /run /tn scheduled_taskname_you_created

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

You can create a scheduled task, and run it as highest priority...then you can execute with cmd line

schtasks /run /tn scheduled_taskname_you_created

Thank you so much!! This option worked :). I really appreciate all of your help!

To be specific about what I did to get this working in Windows 8: I used the Task Scheduler tool (which for some reason in Win 8 only shows up in search if you search for "Schedule Task", weirdly, though the tool is actually still named Task Scheduler) to create a time-based task. I set it to "Run With Highest privileges". Then for my script, I began the script with #RequireAdmin, and then used the run() command to launch PowerShell.

Just figured I'd include these details here in case anyone else is also using Win 8 and does a search for a problem like this in the future.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...