NassauSky Posted May 14 Share Posted May 14 What options might I have to give the user the option if they want to run the current script as Admin during runtime? I haven't tested a possible option to call a 2nd script based on the fact that I wanted to keep all the code together in a single file. Make sense? Link to comment Share on other sites More sharing options...
Andreik Posted May 14 Share Posted May 14 Check this: NassauSky 1 When the words fail... music speaks. Link to comment Share on other sites More sharing options...
NassauSky Posted May 14 Author Share Posted May 14 (edited) Thanks @Andreik ! Was looking for something like this. If Not IsAdmin() Then $bSwitchAdmin = MsgBoxYesNoCancel("You're Not Admin. Would you like to switch over now?") If $bSwitchAdmin Then ShellExecute(@AutoItExe, '"' & @ScriptFullPath & '"', "", "runas") Exit EndIf EndIf MsgBox(0, @ScriptFullPath, "Admin Rights: " & (IsAdmin() = 1) & @CRLF) Func MsgBoxYesNoCancel($message) Local $result = MsgBox(262144+32+3, "Message", $message) ; 262144=topmost 32=iconquestion 3=YesNoCancel If $result = 6 Then ; Yes button Return True ElseIf $result = 7 Then ; No button Return False Else ; Exit button or MsgBox closed Exit EndIf EndFunc Edited May 14 by NassauSky Link to comment Share on other sites More sharing options...
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