Jump to content

Problem with UAC and some other stuff.


Asamoya
 Share

Recommended Posts

I just started learning autoit a couple of days ago, and made the following script to enable/disable my virtualbox file sharing network adapter.

If the adapter is active, I really start lagging when im playing games online etc ^^.

The script enables and disable (toggles) cos the command:

MouseClick ( "left" , 384, 131 , 1 , 0 )
clicks on the first option in the context menu, which is "enable" if the adapter is disabled, and is "disable" if the adapter is enabled.

Here's the full script:

#requireadmin
Run ("explorer.exe /e,::{7007ACC7-3202-11D1-AAD2-00805FC1270E}")
Sleep(100)
WinActivate ("Network Connections", "")
WinSetState ("Network Connections", "", @SW_MAXIMIZE)
Sleep(200)
MouseClick ( "right" , 360, 120 , 1 , 0 )
Sleep(200)
MouseClick ( "left" , 384, 131 , 1 , 0 )
Opt ("MouseCoordMode", 1)
MouseMove ( 730, 430, 0 )
WinKill ("Network Connections", "")

This bit:

MouseMove ( 730, 430, 0 )

When the adapter is enabled/disabled, you get a UAC dialog open up regardless of whether the script has admin privs or not.

So I'm quickly moving the mouse cursor to where the "Yes" button for the UAC would be, so its not too much effort to click the button ^^.

Surprisingly the guys at microsoft have seem to have thought things through quite a bit... the position of the "Yes" button alternates between ~y=380 and ~y=430.

But that's not the problem really, I was wondering if there was any way to click the "Yes" in the UAC dialog automatically, cos it would make the script more "automatic". ;)

// Thinking about it a bit carefully, I wouldn't expect this to be doable, because then it would be a pretty serious risk. Idiots could make viruses (virii?) and easily bypass the UAC defense.

So I think i'll change my question; My script seems a bit crude, with all the windows flashing up etc, any ideas on how to make it more streamlined?

Thanks in advance :)

Edited by Asamoya
Link to comment
Share on other sites

I personally don't use UAC... >_> so I don't know if you could automate it, but the UAC GUI is a process, and I'm sure that you can't, but you could try to end the process. I think it's like consent.exe or something. I know I've been able to do this with the whole ctrl-alt-del hotkey screen thing. I just ended logui.exe (or whatever it was) whenever it started up

one way to get the process, is make a script with a delay that lists the running processes, start that, then start something that prompts UAC, and wait until the script finishes, and look for the odd process out

Edited by mistersquirrle

We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

I personally don't use UAC... >_> so I don't know if you could automate it, but the UAC GUI is a process, and I'm sure that you can't, but you could try to end the process. I think it's like consent.exe or something. I know I've been able to do this with the whole ctrl-alt-del hotkey screen thing. I just ended logui.exe (or whatever it was) whenever it started up

one way to get the process, is make a script with a delay that lists the running processes, start that, then start something that prompts UAC, and wait until the script finishes, and look for the odd process out

Thanks for the replies.

Thats an interesting idea squirrle, but I think I'll leave the script as it is. One extra click isnt too bad :)

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