Adam Burgess Posted May 2, 2006 Share Posted May 2, 2006 (edited) Hi I'm just trying to create a quick installer to install an app I need to rollout. What I want to do is to is use the RunAsSet Function and if the password is correct the go through and install the app otherwise exit the installer if it's incorrect. Below is a copy of what I have done. If the code looks messy it is because it's my first attempt with this so any help would be appreciated. Regards Adam Burgess $sAdminPwd = InputBox("Password", "Please enter the Admistrator Password", "", "*") RunAsSet("Admistrator ", "MyDomain", $sAdminPwd) ;Check if the password is correct if @error = 0 Then MsgBox(64, "Login", "Administrator has logged in successfully") Else MsgBox(64, "Error", "There is an error with your login. Try again later") EndIf Edited May 2, 2006 by Adam Burgess Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 2, 2006 Moderators Share Posted May 2, 2006 I don't play with RunAsSet ever, but a few questions:1. What OS are you trying to use this on?2. I am going to assume since you have a Var for your AdminPassword, that your Domain is not really named "MyDomain"?3. Your @error doesn't seem to be supported with RunAsSet():Success: Returns 1--regardless of success. (If the login information was invalid, subsequent Run/RunWait commands will fail....) Failure: Returns 0 if the operating system does not support this function.Those are Return values not error values.I'll look around to see if I can find anything, but if not, MHz will be on soon, and he loves to play with these functions Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Adam Burgess Posted May 2, 2006 Author Share Posted May 2, 2006 1. I'll be running it on XP SP2 2. That's correct 3. I don't know This is probably (hopefully) a common and easy thing to do. I think I have been just looking at my code to closely and missing the obvious. Cheers Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 2, 2006 Moderators Share Posted May 2, 2006 1. I'll be running it on XP SP22. That's correct3. I don't knowThis is probably (hopefully) a common and easy thing to do. I think I have been just looking at my code to closely and missing the obvious.CheersHere, this thread looked promising, look at how he used Run() after RunAsSet(), you could do error handling after that I'm sure.http://www.autoitscript.com/forum/index.ph...indpost&p=74878 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Geert Posted May 4, 2006 Share Posted May 4, 2006 JdeB made a script for trapping a bad login: Admin.au3 can be found on his page: http://www.autoitscript.com/fileman/users/jdeb/jdeb_autoit_stuff.htm Link to comment Share on other sites More sharing options...
SpookMeister Posted May 4, 2006 Share Posted May 4, 2006 There also apears to be a space after Administrator in your RunAsSet command... that might be causing an issue too. [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] 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