daslick Posted March 26, 2008 Posted March 26, 2008 (edited) RunAs("test", @ComputerName, "admin", 0, @AutoItExe, @WorkingDir, @SW_SHOWDEFAULT) RunAs("test", @ComputerName, "admin", 0, "notepad.exe", @WorkingDir, @SW_SHOWDEFAULT) The first line does not work, but the second does. I've tried using the older RunAsSet with Run, and I get an error that the directory name is invalid. EDIT: I tested this line RunAs("test", @ComputerName, "admin", 0, "cmd /c pause|start " & @AutoItExe, @WorkingDir, @SW_SHOWDEFAULT) And the command prompt said "Access is denied." Edited March 26, 2008 by daslick
Developers Jos Posted March 26, 2008 Developers Posted March 26, 2008 You are trying this with a compiled script ...right? Try: RunAs("test", @ComputerName, "admin", 0, @AutoItExe, "", @SW_SHOWDEFAULT) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
DarkMatter Posted March 26, 2008 Posted March 26, 2008 You could also try something like this: If Not IsAdmin() Then RunAsSet("USERNAME", @ComputerName, "PASSWORD") If @Compiled Then Run('"' & @ScriptFullPath & '"') Exit EndIf EndIf [sub]Quantum mechanics: The dreams stuff is made of[/sub]
Developers Jos Posted March 26, 2008 Developers Posted March 26, 2008 Not really when using the latest Beta which I assume the OP is using looking at the RunAs() statement. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
daslick Posted March 26, 2008 Author Posted March 26, 2008 Tested. With your code I'm getting an Autoit errorLine -1:Error: Unable to execute the external program.Access is denied.
MHz Posted March 27, 2008 Posted March 27, 2008 Tested. With your code I'm getting an Autoit errorYou may need to set a working directory which is valid for access. RunAs("test", @ComputerName, "admin", 0, '"' & @AutoItExe & '"', @TempDir, @SW_SHOWDEFAULT) And some quotes may help as well.
daslick Posted March 27, 2008 Author Posted March 27, 2008 (edited) Has anyone else with Autoit Beta 3.2.11.4 tried this? None of the examples posted here are working for me. EDIT: I STILL have been unable to find a way to have my script use a RunAs/RunAsSet+Run command on itself with this version of Autoit. Help?? Edited March 29, 2008 by daslick
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