TheGeneral Posted November 13, 2008 Posted November 13, 2008 I have some programs that i would like to run as administrator, because without this rights it doesn't work properly. First of all there's only a user in my system, named: The General, and it has admin rights. I tried to use RunAs but I get @error = 1. I tried to use #requireadmin for the script, but it didn't make the script to run the programs as admin. So i would like to know if it's possible. And if it's how?
TehWhale Posted November 13, 2008 Posted November 13, 2008 Yeah, it makes the programs run as admin if you have #RequireAdmin. Show some code.
TheGeneral Posted November 13, 2008 Author Posted November 13, 2008 Yeah, it makes the programs run as admin if you have #RequireAdmin. Show some code.#RequireAdmin AutoItSetOption ( "WinTitleMatchMode", 2 ) Run ( "C:\Program Files (x86)\Silkroad\Loader.exe") WinWaitActive("Testosterone") ControlCommand( "Testosterone", "", "Button6", "Check", "" ) ControlClick ( "Testosterone", "", "Button8" ) WinWait ("SRO_Client") $PID2 = WinGetProcess ("SRO_Client") ProcessSetPriority ( $PID2, 3) Autoit does not run Loader.exe as admin
TheGeneral Posted November 13, 2008 Author Posted November 13, 2008 Hi, sorry about double post but there's no way to delete or edit the old one. So i tried to change: #RequireAdmin AutoItSetOption ( "WinTitleMatchMode", 2 ) Run ( "C:\Program Files (x86)\Silkroad\Loader.exe") WinWaitActive("Testosterone") ControlCommand( "Testosterone", "", "Button6", "Check", "" ) ControlClick ( "Testosterone", "", "Button8" ) WinWait ("SRO_Client") For #RequireAdmin AutoItSetOption ( "WinTitleMatchMode", 2 ) ShellExecute("C:\Program Files (x86)\Silkroad", "", "", "", @SW_MAXIMIZE ) WinWaitActive ( "Silkroad" ) MouseClick ( "left", 204, 328, 2 ) [b]-----> Click on Loader.exe[/b] WinClose ( "Silkroad") WinWaitActive ( "Testosterone" ) ControlCommand ( "Testosterone", "", "Button6", "Check" ) ControlClick ( "Testosterone", "", "Button8" ) And it worked, now loader.exe run with admin rights (UAC is disabled). I would like to know why Run isn't working with this specific program, I tried shellexecute too, and got the same problem. Thx for help
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now