Rawox Posted January 16, 2009 Posted January 16, 2009 (edited) Hi! I'm making an Gmail Auto Login Script. Just for myself In the GUI, I want to have an option that shows or hides the password in the password field So you can see **** or just letters. I already designer the GUI, does anyone knows how to make it work? EDIT: I modified something, I changed the checkbox into a button that already changes to the other thing but doesn't changes back expandcollapse popup#Include <IE.au3> #include <GUIConstantsEx.au3> #Include <EditConstants.au3> Opt("WinTitleMatchMode", 2); Other Option for WinWaitActive Local $msg ;=============BASE============== $GUI = GUICreate("Title", 200, 170, -1, -1) GuiSetFont ( 8.5, 600 ) GUICtrlCreateGroup ( "Username", 10, 8, 180, 45 ) GuiSetFont ( 8.5, 400 ) $Username = GUICtrlCreateInput( "", 20, 25, 160, 20 ) GuiSetFont ( 8.5, 600 ) GUICtrlCreateGroup ( "Password", 10, 58, 180, 70 ) GuiSetFont ( 8.5, 400 ) $Password = GUICtrlCreateInput( "", 20, 75, 160, 20, $ES_PASSWORD ) $Go = GUICtrlCreateButton( "Go!", 10, 137, 180, 25 ) ;=============CHECKBOX============== $button = GUICtrlCreateButton ( "Show Password", 20, 97, 160, 23 ) GUISetState() While 1 $nMsg = GUIGetMsg() Select Case $nMsg = -3 FileDelete(@ScriptDir & "\pic00.jpeg") Exit Case $nMsg = $Go _gMail_Create() Case $nMsg = $button GUICtrlSetData($button, "Hide Password") EndSelect WEnd ;GMAIL FUNCTION Func _gMail_Create() $gMail = Run ( "C:\Program Files\Mozilla Firefox\firefox.exe" ) WinWaitActive ( "Mozilla Firefox" ) WinSetState ( "Mozilla Firefox", "", @SW_MAXIMIZE ) Send ( "{F6}" ) Send ( "http://www.google.com/accounts/Logout?continue=https%3A%2F%2Fwww.google.com%2Faccounts%2FServiceLoginAuth%3Fservice%3Dmail&il=true&zx=1tyc3ues9dy7y {ENTER}" ) WinWaitActive ( "Gmail" ) Sleep ( 2000 ) Global $iColor = 0xE8EEFA $coord = PixelSearch( 952, 256, 1220, 530, $iColor, 10 ) Sleep ( 500 ) MouseClick ( "left", $coord[0], $coord[1], 1, 1 ) Sleep ( 500 ) Send ( "{TAB}" ) Sleep ( 2000 ) Send ( GUICtrlRead($Username) ) Send ( "{TAB}" ) Send ( GUICtrlRead($Password) ) ;Send ( "{ENTER}" ) GUISetState() While 1 $_nMsg = GUIGetMsg() Select Case $_nMsg = -3 Exit Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd EndFunc .Rawox Edited January 16, 2009 by Rawox
BrettF Posted January 16, 2009 Posted January 16, 2009 Best I could come up with was this: #include <GUIConstantsEx.au3> #include <EditConstants.au3> $shown = True $Form1 = GUICreate("Form1", 140, 74, 193, 125) $Input1 = GUICtrlCreateInput("Input1", 8, 8, 121, 21) $Button1 = GUICtrlCreateButton("Show/Hide", 8, 40, 123, 25, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $read = GUICtrlRead ($Input1) GUICtrlDelete ($Input1) If $shown Then $shown = False $Input1 = GUICtrlCreateInput($read, 8, 8, 121, 21, $ES_PASSWORD) Else $shown = True $Input1 = GUICtrlCreateInput($read, 8, 8, 121, 21, $GUI_SS_DEFAULT_INPUT) EndIf EndSwitch WEnd It seems that this doesn't work: #include <GUIConstantsEx.au3> #include <EditConstants.au3> $shown = True $Form1 = GUICreate("Form1", 140, 74, 193, 125) $Input1 = GUICtrlCreateInput("Input1", 8, 8, 121, 21) $Button1 = GUICtrlCreateButton("Show/Hide", 8, 40, 123, 25, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 If $shown Then $shown = False GUICtrlSetStyle ($Input1, $ES_PASSWORD) Else $shown = True GUICtrlSetStyle ($Input1, $GUI_SS_DEFAULT_INPUT) EndIf EndSwitch WEnd I believe it is because the style cannot be dynamically changed to have $ES_PASSWORD. Either that or my code is wrong.... Cheers, Brett 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!
Rawox Posted January 16, 2009 Author Posted January 16, 2009 (edited) Not totally working, when I click show Password then I need to click twice... expandcollapse popup#Include <IE.au3> #include <GUIConstantsEx.au3> #Include <EditConstants.au3> Opt("WinTitleMatchMode", 2); Other Option for WinWaitActive Local $msg $shown = True ;=============BASE============== $GUI = GUICreate("Title", 200, 170, -1, -1) GuiSetFont ( 8.5, 600 ) GUICtrlCreateGroup ( "Username", 10, 8, 180, 45 ) GuiSetFont ( 8.5, 400 ) $Username = GUICtrlCreateInput( "", 20, 25, 160, 20 ) GuiSetFont ( 8.5, 600 ) GUICtrlCreateGroup ( "Password", 10, 58, 180, 70 ) GuiSetFont ( 8.5, 400 ) $Password = GUICtrlCreateInput( "", 20, 75, 160, 20, $ES_PASSWORD ) $Go = GUICtrlCreateButton( "Go!", 10, 137, 180, 25 ) ;=============CHECKBOX============== $button = GUICtrlCreateButton ( "Show Password", 20, 97, 160, 23 ) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = -3 FileDelete(@ScriptDir & "\pic00.jpeg") Exit Case $nMsg = $Go _gMail_Create() Case $nMsg = $button $read = GUICtrlRead ($Password) GUICtrlDelete ($Password) If $shown Then $shown = False $Password = GUICtrlCreateInput($read, 20, 75, 160, 20, $ES_PASSWORD) GUICtrlSetData($button, "Show Password") Else $shown = True $Password = GUICtrlCreateInput($read, 20, 75, 160, 20, $GUI_SS_DEFAULT_INPUT) GUICtrlSetData($button, "Hide Password") EndIf EndSelect WEnd ;GMAIL FUNCTION Func _gMail_Create() $gMail = Run ( "C:\Program Files\Mozilla Firefox\firefox.exe" ) WinWaitActive ( "Mozilla Firefox" ) WinSetState ( "Mozilla Firefox", "", @SW_MAXIMIZE ) Send ( "{F6}" ) Send ( "http://www.google.com/accounts/Logout?continue=https%3A%2F%2Fwww.google.com%2Faccounts%2FServiceLoginAuth%3Fservice%3Dmail&il=true&zx=1tyc3ues9dy7y {ENTER}" ) WinWaitActive ( "Gmail" ) Sleep ( 2000 ) Global $iColor = 0xE8EEFA $coord = PixelSearch( 952, 256, 1220, 530, $iColor, 10 ) Sleep ( 500 ) MouseClick ( "left", $coord[0], $coord[1], 1, 1 ) Sleep ( 500 ) Send ( "{TAB}" ) Sleep ( 2000 ) Send ( GUICtrlRead($Username) ) Send ( "{TAB}" ) Send ( GUICtrlRead($Password) ) ;Send ( "{ENTER}" ) GUISetState() While 1 $_nMsg = GUIGetMsg() Select Case $_nMsg = -3 Exit Case $msg = $GUI_EVENT_CLOSE ExitLoop EndSelect WEnd EndFunc Any Ideas? Edited January 16, 2009 by Rawox
Rawox Posted January 16, 2009 Author Posted January 16, 2009 Ok, I fixed it: I changed $shown = True To... $shown = False Don't know why,, but it worked
Moderators SmOke_N Posted January 16, 2009 Moderators Posted January 16, 2009 http://www.autoitscript.com/forum/index.php?showtopic=25019 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.
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