Jump to content

ShellExecute vs. Certain Apps vs. Mouse Control


MrBoo
 Share

Recommended Posts

Hi folks,

I'm hoping you can help out here - my script is coming along now, already thanks to the bods on here. It's nothing really complicated or technically impressive, but it doing the job I want it to (so far) and I'm happy with it.

I've got a strange problem I can't figure out though, and I was hoping someone might be able to advise...

One part of my script will run 3DMark06 - I've gotten around the UAC headache this presents, but when I try to launch 3DMark06.exe with a 'Run' command AutoIt says 'This operation requires elevation' or words to that effect (even when the compiled script is run as Administrator this 'Run' doesn't work)...

However, 'ShellExecute' seems to do the trick (again, if the compiled script executable is run as Admin) - and 3DMark06.exe starts normally.

Once it starts, I need to 'click' a few buttons to set up the tests and run them.

In my previous scripts I've always used 'MouseClick' - but in this one I've started to use the tidier ControlClick. That didn't seem to be working in 3DMark however, so I thought I'd give 'MouseClick' a go again. Oddly, that didn't seem to work either (the mouse didn't move), so just trying to do some 'diagnostics' I thought I'd put 'MouseMove' in to see if the pointer would even move. It didn't. Again as part of my diagnostic thought-process, I thought I'd remove the line which actually calls 3DMark06.exe, just to check that the pointer would move. In this case it did; so my attention turned to ShellExecute and 3DMark06.exe itself...

Some examples:

ShellExecute ("C:\Program Files\Futuremark\3DMark06\3DMark06.exe", "", "C:\Program Files\Futuremark\3DMark06\")
Sleep(20000)
MouseMove(750, 655)

...The mouse doesn't move.

Sleep(20000)
MouseMove(750, 655)

...The mouse does move.

ShellExecute ("C:\Windows\notepad.exe", "", "C:\Windows\")
Sleep(20000)
MouseMove(750, 655)

...Again, the mouse moves.

So, would I be right in deducing that somehow 3DMark06.exe is what's causing the issue here? Has anyone ever experienced it with other 3DMark or other applications? Does anyone have any ideas of how I could solve/workaround it?

Many and sincere thanks in advance, and regards,

Rob.

Link to comment
Share on other sites

Well, I've not figured out why 3DMark is giving problems with Mouse/Controls when using ShellExecute but for anyone else in future who may have similar problems I've found a workaround...

Firstly, I was using a RegWrite to turn off Vista UAC... This worked fine when my compiled executable was right-clicked and 'Run as Administrator' to start. 'Run' failed to launch 3DMark06.exe in this case, but 'ShellExecute' was successful; just that there were problems with Controls and Mouse actions.

So (and this is nothing amazing, just getting over my own ignorance, but still...), I removed the 'RegWrite' which disables UAC and used #RequiresAdmin at the top so the user allows my Script to have Admin. In this case I was able to use 'Run' to launch 3DMark06.exe as opposed to 'ShellExecute' - and when using 'Run' the functionality over Controls and Mouse actions is retained.

:D

Regards,

Rob.

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...