DatMCEyeBall Posted September 20, 2013 Share Posted September 20, 2013 Just something I've been wondering, is it possible to do something like this:If Not IsAdmin() Then #requireadmin EndIf "Just be fred, all we gotta do, just be fred." -Vocaliod "That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha @tabhooked Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation Link to comment Share on other sites More sharing options...
Developers Jos Posted September 20, 2013 Developers Share Posted September 20, 2013 Nope.. 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. Link to comment Share on other sites More sharing options...
DatMCEyeBall Posted September 20, 2013 Author Share Posted September 20, 2013 Probably in the next Beta? "Just be fred, all we gotta do, just be fred." -Vocaliod "That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha @tabhooked Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation Link to comment Share on other sites More sharing options...
Developers Jos Posted September 20, 2013 Developers Share Posted September 20, 2013 Probably in the next Beta? Think about this for a moment. What exactly does that statement do? 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. Link to comment Share on other sites More sharing options...
DatMCEyeBall Posted September 20, 2013 Author Share Posted September 20, 2013 If the user doesn't have admin rights, the script elevates it's permissions? "Just be fred, all we gotta do, just be fred." -Vocaliod "That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha @tabhooked Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation Link to comment Share on other sites More sharing options...
Developers Jos Posted September 20, 2013 Developers Share Posted September 20, 2013 (edited) If the user doesn't have admin rights, the script elevates it's permissions? Correct ... the script is reran in Admin mode when it isn't yet. So what exactly are you looking for because your initial question doesn't make any sense for a logic point of view? Edited September 20, 2013 by Jos 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. Link to comment Share on other sites More sharing options...
DatMCEyeBall Posted September 20, 2013 Author Share Posted September 20, 2013 I want to enable admin rights in the middle of script execution. "Just be fred, all we gotta do, just be fred." -Vocaliod "That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha @tabhooked Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted September 20, 2013 Moderators Share Posted September 20, 2013 So as Jos is trying to point out, since the #RequireAdmin reruns the entire script in Admin mode, think about why this wouldn't work. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
DatMCEyeBall Posted September 20, 2013 Author Share Posted September 20, 2013 (edited) So is there another approach to this? Edited September 20, 2013 by DatMCEyeBall "Just be fred, all we gotta do, just be fred." -Vocaliod "That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha @tabhooked Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted September 20, 2013 Moderators Share Posted September 20, 2013 Again, look at what Jos is asking - we need more information on exactly what you are trying to do in order to make suggestions. Post your script or a reproducer, instead of asking us guess "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
DatMCEyeBall Posted September 20, 2013 Author Share Posted September 20, 2013 (edited) I got it, If I put #requireadmin at the beginning of my script it only requests permission if the user doesn't have the correct permissions. The point was I wanted to learn something, not make something. Edited September 20, 2013 by DatMCEyeBall "Just be fred, all we gotta do, just be fred." -Vocaliod "That is a Hadouken. A KAMEHAMEHA would have taken him 13 days and 54 episodes to form." - Roden Hoxha @tabhooked Clock made of cursors ♣ Desktop Widgets ♣ Water Simulation Link to comment Share on other sites More sharing options...
Morthawt Posted September 20, 2013 Share Posted September 20, 2013 You can't use #requireadmin within a conditional statement. I had an idea long ago to make a script once that would only ask for admin mode if a particular action was needed, else stay with user access but it didn't work. Either your script will have admin or it won't. Free and easy Autoit scripting video tutorials (plus more videos always coming!) General video tutorials, especially correct and safe TeamSpeak permissions tutorials. Link to comment Share on other sites More sharing options...
AdamUL Posted September 21, 2013 Share Posted September 21, 2013 To conditionally elevate your whole script, you could use the following. If Not IsAdmin() Then If @Compiled then ShellExecute(@ScriptFullPath, "", @ScriptDir, "runas") Else ShellExecute(@AutoItExe, '"' & @ScriptFullPath & '"', @ScriptDir, "runas") EndIf Exit EndIf Have a look at this >thread on elevating and delevating your script. Adam 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