BrettF Posted October 10, 2007 Share Posted October 10, 2007 (edited) _LoginBox UDF A simple script that shows a customizable login box, with User, Password, Prompt etc Current Version: 4 Last Updated: 6 Febuary 2009 Download Link(Direct) This script is fairly simple. It shows a customizable "login box", housing a username and password field, along with user-defined options. It can easily be added to you script. The download includes the function along with the example.PLEASE NOTE: THIS FUNCTION IS NOT DESIGNED TO DO ANY OF THE FOLLOWING; AUTOMATICALLY LOG YOU INTO A WEBPAGE/PROGRAM/WINDOWS/ETC, STORE YOUR PASSWORDS (THIS FUNCTION RECEIVES THE USERNAME AND PASSWORD, THEN PASSES IT TO THE SCRIPT USING THE RETURN VALUE). IT IS NOT DESIGNED TO DO ANY OF THESE THINGS, SO THEY WILL NOT BE IMPLEMENTED.Comment Appreciated. Enjoy Thanks To: JerryD GEOSoft Changelog: UPDATED 3! Thanks GeoSoft, a whole ton of updates to the function. (August 20 2008) UPDATED 2! I think I have a way to stop the errors from popping up. Just a nuther parameter... (October 11 2007) UPDATED! Thanks to JerryD's ideas, this is so much better. The timeout does get annoying though... Comments on how that part could be better appreciated. (October 11 2007) INITIAL VERSION! October 10 2007 Edited August 2, 2009 by BrettF Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
ashley Posted October 10, 2007 Share Posted October 10, 2007 No offence... BUT if you use koda the gui is already made for you! Free icons for your programs Link to comment Share on other sites More sharing options...
BrettF Posted October 10, 2007 Author Share Posted October 10, 2007 It Is? Where? I don't see one. Never have... No offence taken... And tell me. Does KODA do anything else with the GUI? Create the functions... Set the errors... I think not. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
JerryD Posted October 10, 2007 Share Posted October 10, 2007 It Is? Where? I don't see one. Never have... No offence taken... And tell me. Does KODA do anything else with the GUI? Create the functions... Set the errors... I think not.Bert - don't worry about that (and I don't know what ashley means by the gui is already made for you anyway). It's a nice enough function that I'm planning on using it soon, although with a few modifications... Your default values in the function declaration for $left and $top set the values to 0 and put the login box in the top left corner of the screen, but the default -1 centers it on the screen. It doesn't really matter which it is, it's just inconsistent (using no parameter should behave the same as using the -1 parameter).Once the password is typed in, hitting [Enter] doesn't do anything - you have to hit [OK]. Adding the line GUICtrlSetState($okbtn, $GUI_DEFBUTTON) makes the OK button the default action when [Enter] is hit.I would use seterror differently. Right now the function returns a value (array) if it works, but returns ??? if Cancel or Exit is returned. I would return 0 in those lines. Your SetError(0, 1) is setting @error to 0, and @extended to 1 (or 2 if timed out). It would be more effective if you used SetError(1, 1,0) for returning Cancel/Exit and SetError(1, 2,0) for the function timing out. That way, you can use either If NOT _LoginBox() or If @error.On my enhancement list:rework the GUI to use all relative positioning so that buttons, labels, etc. are more dynamic relative to the size of the size of the formRestrict the minimum size allowed for all dimenstions (along with item above)allow setting the active control to either the username field or the password fieldchange the default timeout to 0 and change the line to Case TimerDiff($time) > $timeout And $timeout (I think it would be a tad quicker)And please keep in mind, I wouldn't even waste my time posting if the function wasn't worth the trouble - it's fundamentally a very nice funtion. And I will NOT be offended if you couldn't care less about what I think of it either. My only intent is to compliment your work. Link to comment Share on other sites More sharing options...
BrettF Posted October 10, 2007 Author Share Posted October 10, 2007 Bert - don't worry about that (and I don't know what ashley means by the gui is already made for you anyway). It's a nice enough function that I'm planning on using it soon, although with a few modifications...Your default values in the function declaration for $left and $top set the values to 0 and put the login box in the top left corner of the screen, but the default -1 centers it on the screen. It doesn't really matter which it is, it's just inconsistent (using no parameter should behave the same as using the -1 parameter).Once the password is typed in, hitting [Enter] doesn't do anything - you have to hit [OK]. Adding the line GUICtrlSetState($okbtn, $GUI_DEFBUTTON) makes the OK button the default action when [Enter] is hit.I would use seterror differently. Right now the function returns a value (array) if it works, but returns ??? if Cancel or Exit is returned. I would return 0 in those lines. Your SetError(0, 1) is setting @error to 0, and @extended to 1 (or 2 if timed out). It would be more effective if you used SetError(1, 1,0) for returning Cancel/Exit and SetError(1, 2,0) for the function timing out. That way, you can use either If NOT _LoginBox() or If @error.On my enhancement list:rework the GUI to use all relative positioning so that buttons, labels, etc. are more dynamic relative to the size of the size of the formRestrict the minimum size allowed for all dimenstions (along with item above)allow setting the active control to either the username field or the password fieldchange the default timeout to 0 and change the line to Case TimerDiff($time) > $timeout And $timeout (I think it would be a tad quicker)And please keep in mind, I wouldn't even waste my time posting if the function wasn't worth the trouble - it's fundamentally a very nice funtion. And I will NOT be offended if you couldn't care less about what I think of it either. My only intent is to compliment your work.Thankyou Jerry That's the type of feedback I like. I will take that all on board, and when I get out of bed, I will fix it up when I am at school. Thankyou Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Nahuel Posted October 10, 2007 Share Posted October 10, 2007 very nice Bert. I love all the options it has, very professional. Link to comment Share on other sites More sharing options...
BrettF Posted October 10, 2007 Author Share Posted October 10, 2007 Thankyou Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
RazerM Posted October 10, 2007 Share Posted October 10, 2007 I like the layout, add those great suggestions by JerryD and the UDF will be a lot better. My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
BrettF Posted October 10, 2007 Author Share Posted October 10, 2007 Ok. I have added some of JerryD's request. First Post Updated. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
zFrank Posted August 1, 2008 Share Posted August 1, 2008 you have done really a good job. i am going to use it in my program. Thanks! [font="Georgia"]GSM Expert[/font] but not AutoIt :DProud to be Admin Of : http://www.gsmhosting.net/visit my Forum... http://www.gsmhosting.net/vbb/index.php$Life = "Happy" If @Error Then $Life = "Risk" Link to comment Share on other sites More sharing options...
smartee Posted August 2, 2008 Share Posted August 2, 2008 great work man you should add in call authentication too. Link to comment Share on other sites More sharing options...
GEOSoft Posted August 2, 2008 Share Posted August 2, 2008 (edited) Good work Brett. Tidy is reporting errors but I don't see any in the script so I suspect it's just Tidy. Edit. Why are you allowing defaults for the username and password? Isn't the purpose of a login dialog to force the user to enter those values? Personally I would remove those two parameters, but that's just me. Edit 2. I solved the Tidy Errors (code available) but there is one error that I just spotted. $Label1 = GUICtrlCreateLabel("Password:", 4, 72, 62, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Label1 = GUICtrlCreateLabel("Username:", 4, 44, 64, 17)Both inputs have the same variable name. But no matter, because you don't need to name them anyway since they are not referenced again. Edited August 2, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
GEOSoft Posted August 2, 2008 Share Posted August 2, 2008 great work man you should add in call authentication too.What do you mean by "call authentication"? Example? George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
zFrank Posted August 19, 2008 Share Posted August 19, 2008 its good, i was trying to do something like this. Thanks for this. [font="Georgia"]GSM Expert[/font] but not AutoIt :DProud to be Admin Of : http://www.gsmhosting.net/visit my Forum... http://www.gsmhosting.net/vbb/index.php$Life = "Happy" If @Error Then $Life = "Risk" Link to comment Share on other sites More sharing options...
TehWhale Posted August 19, 2008 Share Posted August 19, 2008 (edited) You have this setup all whack... #include <GUIConstants.au3> #include <EditConstants.au3> $ret = _LoginBox("Enter Credentials", "Please enter you username and password", "username", "password", -1, -1, -1, -1, -1, 0) If Not @error Then MsgBox(0, "Credentails Returned", "Username: " & $ret[0] & @CRLF & "Password: " & $ret[1]) EndIf That doesn't work. It doesn't give me the info when i press ok, but this does: #include <GUIConstants.au3> #include <EditConstants.au3> $ret = _LoginBox("Enter Credentials", "Please enter you username and password", "username", "password", -1, -1, -1, -1, -1, 0) If @error Then MsgBox(0, "Credentails Returned", "Username: " & $ret[0] & @CRLF & "Password: " & $ret[1]) EndIf EDIT: And -1 doesn't work for the timeout, you have to have 0... EDIT: You also need EditConstants included or else it wil error out with $ES_Password. Edited August 19, 2008 by Alienware Link to comment Share on other sites More sharing options...
BrettF Posted August 19, 2008 Author Share Posted August 19, 2008 GeoSoft did some work, and I'll post it when I get more time to fix it all up... Soon I promise! Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
BrettF Posted August 20, 2008 Author Share Posted August 20, 2008 Updated! Thanks GeoSoft! Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
TehWhale Posted August 20, 2008 Share Posted August 20, 2008 Very nice Brett. What happened to the default username/password spot? Also, maybe you should have at the very end a $hHwnd parameter, like the messagebox does. Link to comment Share on other sites More sharing options...
GEOSoft Posted August 20, 2008 Share Posted August 20, 2008 Very nice Brett. What happened to the default username/password spot? Also, maybe you should have at the very end a $hHwnd parameter, like the messagebox does.having a default password makes no sense at all. The idea is to force someone to enter the information. If you used default username and password then all that was required was to click the OK button, which anyone could do. That bypasses the security that you wanted to begin with. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Anteaus Posted August 20, 2008 Share Posted August 20, 2008 You might be able to pull a few coding tips from this, it's open-source anyway and mostly written in (oh, you know what...) http://sourceforge.net/projects/mylogon 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