rejectpenguin Posted January 23, 2006 Share Posted January 23, 2006 Im reletivley new to auto it and dont really understand most functions. But i know enough to make programs that are good enough for my use. I dont use Gui or anything yet and am still learning. I need some help with something though.. Is it possible to make a popup at the beggining of a specific program to ask for a password then if the password is right, run the rest of the script. But heres the tricky part.. I want the password to be whatever a specific web page says. So.. if I had a webpage that said cornonthecob on it, the password for the program would be cornonthecob. And the password would be changed whenever I change the text on the web page. I dont have any code right now and I mostly learn off looking at other peoples code or examples. So feel free to post... Also if you wouldnt mind NOT using GUI as i dont really understand it yet, it would help me more as I would understand it better. Thanks For all the reply to this post. RejectPenguin Link to comment Share on other sites More sharing options...
ACalcutt Posted January 23, 2006 Share Posted January 23, 2006 (edited) While 1 $pass = InputBox ( "Password Needed", "Please Enter you password" , "" , "*") If @error = 1 Then Exit; exit if cancle is pressed If $pass = "Password" Then msgbox(0, "", "Correct!") ExitLoop Else msgbox(0, "", "WRONG!!!! Re-Enter") EndIf WEnd maybe you could use WinGetTitle to do the password from a webpage thing....thats a long password though Untested While 1 $pass = InputBox ( "Password Needed", "Please Enter you password" , "" , "") If @error = 1 Then Exit; exit if cancle is pressed $title = WinGetTitle("Microsoft Internet Explorer", "") If $pass = $title Then msgbox(0, "", "Correct!") ExitLoop Else msgbox(0, "", "WRONG!!!! Re-Enter") EndIf WEnd Edited January 23, 2006 by ACalcutt Andrew Calcutt Http://www.Vistumbler.net Http://www.TechIdiots.net Its not an error, its a undocumented feature Link to comment Share on other sites More sharing options...
rejectpenguin Posted January 23, 2006 Author Share Posted January 23, 2006 (edited) I need it to read the CONTENT on the webpage without it having to open the webpage.. I want this so that I can remotley change the password of the program whenever I want without having to edit any code or anything. Just change the web page. Edited January 23, 2006 by rejectpenguin Link to comment Share on other sites More sharing options...
seandisanti Posted January 23, 2006 Share Posted January 23, 2006 I need it to read the CONTENT on the webpage without it having to open the webpage.. I want this so that I can remotley change the password of the program whenever I want without having to edit any code or anything. Just change the web page.something like this? InetGet("http://whatever.com/whatever.txt",@TempDir & "\whatever.txt") $correct = FileReadLine(@TempDir & "\whatever.txt") If InputBox("Validation","Enter password","NotIT","¿") <> $correct Then Exit Link to comment Share on other sites More sharing options...
rejectpenguin Posted January 23, 2006 Author Share Posted January 23, 2006 (edited) For example heres kinda the logic i want. Enter Password checks webpage to see if password matches If password matches perform the rest of script. Else exit. Edited January 23, 2006 by rejectpenguin Link to comment Share on other sites More sharing options...
rejectpenguin Posted January 23, 2006 Author Share Posted January 23, 2006 Yeah i think thats it cameron.. let me test. Link to comment Share on other sites More sharing options...
seandisanti Posted January 23, 2006 Share Posted January 23, 2006 Yeah i think thats it cameron.. let me test.the code assumes that the web based file is a file with the exact password being the first line of text. if you're not able to create that condition, you'll have to write more code to parse out the desired password. Link to comment Share on other sites More sharing options...
rejectpenguin Posted January 23, 2006 Author Share Posted January 23, 2006 (edited) i think it works but when i try to add an else clause it says theres no if statement.. InetGet("http://whatever.com/whatever.txt",@TempDir & "\whatever.txt") $correct = FileReadLine(@TempDir & "\whatever.txt") If InputBox("Validation","Enter password","NotIT","*") <> $correct Then Exit Else <--- THERE! Edited January 23, 2006 by rejectpenguin Link to comment Share on other sites More sharing options...
seandisanti Posted January 23, 2006 Share Posted January 23, 2006 i think it works but when i try to add an else clause it says theres no if statement.. InetGet("http://www.angelfire.com/planet/rejectpenguin/password.txt",@TempDir & "\password.txt") $correct = FileReadLine(@TempDir & "\password.txt") If InputBox("Validation","Enter password","NotIT","*") <> $correct Then Exit Else <--- THERE!the reason why is because my "IF" isn't a block if, it's all on one line, eliminating the need for an else or an end if. as it is right now it just exits if the password is wrong. not sure why you'd need an else, except maybe to give them more chances... if that's what you want to do, i'd say to do it as such: InetGet("http://whatever.com/whatever.txt",@TempDir & "\whatever.txt") $correct = FileReadLine(@TempDir & "\whatever.txt") Do $attempt = InputBox("Validation","Enter password","NotIT","¿") Until $attempt = $correct Link to comment Share on other sites More sharing options...
rejectpenguin Posted January 23, 2006 Author Share Posted January 23, 2006 Ok nvm.. Im dumb I thought I needed an else to execute the code.. But I see now.. One more thing. The InetGet("http://whatever.com/whatever.txt",@TempDir & "\whatever.txt"). Does that download the file or read directly off the web page? Also does this go into your history in Internet Explorer? Link to comment Share on other sites More sharing options...
seandisanti Posted January 24, 2006 Share Posted January 24, 2006 Ok nvm.. Im dumb I thought I needed an else to execute the code.. But I see now..One more thing. The InetGet("http://whatever.com/whatever.txt",@TempDir & "\whatever.txt"). Does that download the file or read directly off the web page?Also does this go into your history in Internet Explorer?it actually just downoads the file to the location specified, in my example that's @temp\whatever.txt it would just take a FileDelete() to get rid of the file once it's served it's purpose, as far as whether or not it goes into history, i don't believe so, but it would just take you a second to check and be sure. let us know what you find. Link to comment Share on other sites More sharing options...
ACalcutt Posted January 24, 2006 Share Posted January 24, 2006 you may want to use some form of encryption for the password...or else they would just be able to go to that page and view the password like _StringEncrypt Andrew Calcutt Http://www.Vistumbler.net Http://www.TechIdiots.net Its not an error, its a undocumented feature Link to comment Share on other sites More sharing options...
seandisanti Posted January 24, 2006 Share Posted January 24, 2006 you may want to use some form of encryption for the password...or else they would just be able to go to that page and view the passwordlike_StringEncryptyes any added level of security is a good idea. Link to comment Share on other sites More sharing options...
shoshin42 Posted January 27, 2006 Share Posted January 27, 2006 You might also try something like this if you use the IE.au3 include file. #include <IE.au3> AutoItSetOption("WinDetectHiddenText", 1) $o_IE = _IECreate(0); creates hidden browser window _IENavigate($o_IE, "http:\\www.somewhere.com\passwordpage.html") ; navigates to your password page $correct = WinGetText("name of browser window") ; reads text on your password page I tested this and it worked after I put a couple Sleep commands in to make sure the pages were completely loaded. Not elegant, but Sleeps are good enough for me when I'm testing. #include <IE.au3> AutoItSetOption("WinDetectHiddenText", 1) $o_IE = _IECreate(0); creates hidden browser window Sleep(1500) _IENavigate($o_IE, "http:\\www.somewhere.com\passwordpage.html") ; navigates to your password page Sleep(1500) $correct = WinGetText("name of browser window") ; reads text on your password page _IEQuit($o_IE) You need to have the AutoItSetOption command so that the WinGetText command will be able to read text from the hidden window. The user never sees a browser window open and the page isn't saved to your computer. It might show up in history or the cache files. If so, and you are concerned about it, add to the script to find and delete those files once the page is finished. 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