Sign in to follow this  
Followers 0
murky024

GUICreate Issue

5 posts in this topic

So I have tested a bit of code that allows me to store login and password information and use it later on to login.

See Code below

Func LoginInfo()
    Local $User, $Password
Local $btn, $msg
Global $Usr, $Pwd
   GUICreate(" User Name and Password for ESQ", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1)
   $User = GUICtrlCreateInput("", 10, 5, 300, 20)
   $Password = GUICtrlCreateInput("", 10, 35, 300, 20,0x0020)
   $btn = GUICtrlCreateButton("Ok", 40, 75, 60, 20)
   GUISetState()
   $msg = 0
  While $msg <> $GUI_EVENT_CLOSE
        $msg = GUIGetMsg()
        Select
            Case $msg = $btn
                ExitLoop
        EndSelect
    WEnd
  
   $Usr = GUICtrlRead($User)
   $Pwd = GUICtrlRead($Password)
    ;MsgBox(4096, "User and Password", GUICtrlRead($User))
;MsgBox(0,"Password",GUICtrlRead($Password))
EndFunc

LoginInfo()
#include <IE.au3>
MsgBox(4096, "User and Password", $Usr)
MsgBox(0,"Password",$Pwd)
$URL = "https://google.com"
$IE = _IECreate($URL, 0, 0, 0)
$HWND = _IEPropertyGet($IE, "hwnd")
WinSetState($HWND,"",@SW_MAXIMIZE)
_IEAction($IE, "visible")
_IELoadWait($IE)
Sleep(1000)
Sleep(1000)
MouseClick("Left",-685,274)
Send($Usr)
Sleep(1000)
MouseClick("Left",-685,296)
Send($Pwd)
Sleep(500)
Send(@CR)

Once I use this working code in my larger program it fails. It won't store the login and password information, nor will it wait for rest of the program until the login information is entered.

What am I doing wrong?

Share this post


Link to post
Share on other sites



i am soory but pls reread our Forum Rules

SPAM tools including instant messenger or forum auto-posters. This includes forum or site auto-login methods.

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Please ignore the first responder. There are plenty of reasons to use automated logins. Let me find some of the methods posted by MVPs here that I have used.

;~ #1: this one works well
#include <IE.au3>
$URL = "yoururlhere.com"
$ObjIE = ObjCreate("InternetExplorer.Application")
With $ObjIE;Wait until Forwarding Website loads
.Visible = True
.Navigate ($URL)
Do
  Sleep(50)
Until .ReadyState = 4
EndWith
With $ObjIE.document.forms (0);Set Form Objects on Website
.username.value = "Usernamehere"
.password.value = "Passwordhere"
.submit
EndWith
;~ End #1: this one works well

;~ #2: this one works better
_IENavigate ($oIE, "YourURLHere.com") ; Fill out a page and submit
_IELoadWait ($oIE)
$oForms1 = _IEFormGetObjByName($oIE, "NameOfFormHere")          
$oNum1 = _IEFormElementGetObjByName($oForms1, "NameOfemailField")  
$oNum2 = _IEFormElementGetObjByName($oForms1, "NameOfPasswordField")  
$Email = ""
$Password = ""                
_IEFormElementSetValue($oNum1, $Email)  
_IEFormElementSetValue($oNum2, $Password)   
_IEFormSubmit($oForms1)       ; Sumbit
;~ #2: this one works better
Edited by John117

Share this post


Link to post
Share on other sites

Please ignore the first responder.

Oh no you didn't. Advocating ignoring somebody who is parroting the rules I helped create and posted means you are advocating ignoring me. In general that is not a good idea. You have a couple days to think about that.

There are plenty of reasons to use automated logins.

Indeed there are. There are plenty of legitimate reasons to do a lot of things that break rules and laws. That does not mean we discard the rules on a whim, however. The rules are what they are. Right/wrong, agree/disagree they are clearly posted and known to be enforced so people need to either deal with them and work within their constraints or find another forum.

Thread locked and as mentioned, John117 banned for a couple days to think about rules and why ignoring them (and me) is a bad idea.

Share this post


Link to post
Share on other sites

I just noticed John117 has been reprimanded no less than 3 times by me within a 3 week period at the end of 2007 through early 2008. Making a note here: Huge Success. No wait, making a note that the next time will be permanent removal.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0

  • Similar Content

    • Jibberish
      By Jibberish
      I am having difficulties getting updated results from GUICtrlCreateInput. I wrote a small script to demonstrate what I am trying to do.
      This script reads a text file into an array and displays the Name and Number from the text file.
      The user can check a name and change the number, and the results are displayed in _ArrayDisplay.
      Only the Checked names are displayed in their original position. This is necessary for future
      plumbing.
      The problem with this script is the original number is returned, not the changed number. I cannot
      figure out how to get the updated number to be displayed.
      ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; This script reads a text file into an array and displays the Name and Number from the text file. ; The user can check a name and change the number, and the results are displayed in _ArrayDisplay. ; Only the Checked names are displayed in their original position. This is necessary for future ; plumbing. ; ; The problem with this script is the original number is returned, not the changed number. I cannot ; figure out how to get the updated number to be displayed. ; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #include-once #include <MsgBoxConstants.au3> #include <array.au3> #include <Date.au3> #include <WinAPIFiles.au3> #include <AutoItConstants.au3> #include <Misc.au3> #include <File.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> Local $iMax = 6 ;Default number of Videos - 1 for the array counter Dim $aTextFile[$iMax][2] ; [start with 5 entries][Name, Number] Don't get confused! [Row][Column] Local $i = 0 Local $iLeft = 30 Local $iTop = 30 Local $sName Local $sNumber Local $aArray Local $iMaxCol = 5 Local $iRow = 0 Local $iCol = 0 Local $aNumberCount[$iMaxCol][2] $aArray1 = ReadFile() $aNamesNumbers = DisplayNames($aArray1) _ArrayDisplay($aNamesNumbers) ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; ReadFile() places the contents of the NameNumber.txt file in an array ; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Func ReadFile() Local $sFileData = @ScriptDir & "\NameNumber.txt" Local $iStrReturn = 0 Local $aArrayFile Local $aTextFile[$iMaxCol][2] Local $aName Local $sCheckBox1 Const $iL = 10 ; Count from Left for GUI so all buttons line up Local $sFill Local $iA = 0, $iN = 0 ; Put the Names into an Array _FileReadToArray($sFileData, $aArrayFile) For $iA = 0 To $aArrayFile[0] ; Step through the array looking for Names If StringInStr($aArrayFile[$iA], "Name:") Then $aName = StringSplit($aArrayFile[$iA],":") $sFill = $aName[2] If UBound($aTextFile) <= $iRow Then ; Resize the array when $iRow is equal to the element count in the array to prevent subscript error ReDim $aTextFile[UBound($aTextFile) + 1][$iMaxCol] EndIf $aTextFile[$iRow][$iCol] = $sFill $iRow += 1 EndIf Next $iCol = 1 $iRow = 0 $sFill = "" For $iA = 1 To $aArrayFile[0] ; Step through the array looking for Numbers If StringInStr($aArrayFile[$iA], "Number:") Then $aName = StringSplit($aArrayFile[$iA],":") $sFill = $aName[2] If UBound($aTextFile) <= $iRow Then ; Resize the array when $iRow is equal to the element count in the array to prevent subscript error ReDim $aTextFile[UBound($aTextFile) + 1][$iMaxCol] EndIf $aTextFile[$iRow][$iCol] = $sFill $iRow += 1 EndIf Next Return $aTextFile EndFunc ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Display the Name and Number ; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Func DisplayNames($aArray1) Local $aName[$iMax] Local $aNumbers[$iMax] $iMMCount = UBound($aArray1) $iMMCount -=1 Local $iWidth = 300 Local $iLength = 300;$iMMCount * 30 GUISetFont(12) $hGUI = GUICreate("Edit / Update Number Test", $iWidth, $iLength, -1, -1) GUICtrlCreateLabel(" Name Number",1,5) ;$iTop += 30 ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Display Name with a Checkbox. Only Checked Names should be saved. ; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For $i = 0 to $iMMCount Step 1 $sNameText = $aArray1[$i][0] $iNameLength = StringLen($sNameText) $aName[$i] = GUICtrlCreateCheckbox($sNameText,$iLeft, $iTop) $iTop += 30 Next ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Display the number from the text file below each name. Allow the user to change the number and display the ; new number. ; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $iLeft = 60 GUIStartGroup() $iTop = 28 For $i = 0 to $iMMCount Step 1 $sNumberText = $aArray1[$i][1] $aNumberCount[$i][1] = $sNumberText $aNumberCount[$i][0] = GUICtrlCreateInput($sNumberText,$iLeft, $iTop, 50,18, $GUI_DOCKAUTO) GUICtrlSetPos($aNumberCount[$i][0],200) $iTop += 30 Next ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Read the checked names and (possibly updated) number ; ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ $iMMCount = UBound($aNumberCount) $iMMNewCount = $iMMCount - 1 Local $aGUICheckbox[$iMMCount] Local $aCheckedNameNumber[$iMMCount][2] $iLeft = 30 Local $idCloseGUI = GUICtrlCreateButton("Close",$iLeft, $iTop) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $idCloseGUI For $i = 0 To $iMMNewCount Step 1 Switch GUICtrlRead($aName[$i]) Case $GUI_CHECKED $aCheckedNameNumber[$i][0] = $aArray1[$i][0] Case $GUI_UNCHECKED EndSwitch Switch GUICtrlRead($aNumberCount[$i][0]) Case $aCheckedNameNumber[$i][1] = GUICtrlRead($aNumberCount[$i][1]) EndSwitch Next ExitLoop EndSwitch WEnd For $i = 0 to $iMMNewCount step 1 GUICtrlRead($aNumberCount[$i][0]) If $aCheckedNameNumber[$i][0] <> "" Then $aCheckedNameNumber[$i][1] = $aNumberCount[$i][1] EndIf Next GUIDelete($hGUI) Return $aCheckedNameNumber EndFunc This is the text file I am reading. If you want to try this out put the NameNumber.txt file in your script directory. It's attached to the post.
      * This is a dummy file with a Name and Number * The only purpose of this file is to read the updated Number. Name:Taggart Number:916 Name:Mongo Number:90 Name:Hedley Lamarr Number:22 Name:Bart Number:9999 Name:The Waco Kid Number:2244 If I change the number, the original number is displayed at the end, not the updated/modified number. I need the modified number to be displayed.
      Thanks in advance for any assistance!
      Jibberish
      NameNumber.txt
    • VIP
      By VIP
      I can not do anything with any user in the "Local Users Group"
      I tried from my account but I could not change my password (ie set new password)!
      But I was able to activate the Administrator account and I logged into the Administrator account and still could not do anything with my account! But I can set the password and disable the Administrator account from my account or Administrator.
      Any ideas? (Ignore the click on the Sign-in option in the Change Accout settings.)
       

    • Skysnake
      By Skysnake
      Hi
      Maybe I am just being silly, but I don't understand what is supposed to happen here.
      ::/html/functions/GUICreate.htm
      GuiCreate from the Help file has 2 examples.  Specifically, the 2nd example creates a ChildGui.  Or so it says.  I do not see this on screen.
      $hGUI gets created, no problem.
      Local $hChild = GUICreate("ChildGui", 10, 10, 20, 20, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_MDICHILD), $hGUI) What exactly does this line do? Should I see it on screen?
      Skysnake
    • Daka
      By Daka
      Global $l = GUICtrlCreateInput("3", 16, 48, 25, 22, $ES_NUMBER) Global $p = GUICtrlCreateInput("3", 56, 48, 25, 22, $ES_NUMBER) $go = GUICtrlCreateButton("Start", 136, 48, 83, 25) Global $m = GUICtrlCreateInput("1", 96, 48, 25, 22, $ES_NUMBER) Case $go $l = Number(GUICtrlRead($l)) $p = Number(GUICtrlRead($p)) $m = Number(GUICtrlRead($m)) Then I say consolewrite:
      ConsoleWrite(" l: " & $l & " p: " & $p & " m: " & $m & @LF); And first time when I hit Start ($go) button it gives me default numbers and works fine
      l: 3 p: 3 m: 1 But then I hit Start again and no need to change the numbers in input it gives me:
      l: 68 p: 68 m: 0 Then I hit again Start and this is result:
      l: 0 p: 0 m: 0 from this moment it is all the time 0 (zero) so what could be this?
    • Skysnake
      By Skysnake
      I think I am missing something obvious
      I want the "color bar" to stretch from side to side (entire width) of the GUI.  On resize it must expand / contract as necessary.  I guess the answer is easy, but I need a bit of help please?
      $hForm = GUICreate('myColor Picker', 300, 200,-1, -1, $WS_MAXIMIZEBOX + $WS_SYSMENU + $WS_CAPTION) ;color the GUI background ;GUISetBkColor($sColorformFile, $hForm) ; set the gui background color ;Local $mycolorLabel = GUICtrlCreateLabel("",10,10,300,10) ; a blank LABEL color bar Local $mycolorLabel = GUICtrlCreateGraphic( -1,-1,300,10) ; a blank GRAPHIC color bar GUICtrlSetResizing($mycolorLabel, $ws_sizebox);$GUI_DOCKMENUBAR);$GUI_DOCKAUTO) ;$GUI_DOCKBORDERS) GUICtrlSetBkColor($mycolorLabel,$sColorformFile) ; set the color for the label  
      This is an extract from here, by @Yashied
      $hForm = GUICreate('myColor Picker', 300, 200,-1, -1, $WS_MAXIMIZEBOX + $WS_SYSMENU + $WS_CAPTION) ;color the GUI background ;GUISetBkColor($sColorformFile, $hForm) ; set the gui background color ;Local $mycolorLabel = GUICtrlCreateLabel("",10,10,300,10) ; a blank LABEL color bar Local $mycolorLabel = GUICtrlCreateGraphic( -1,-1,300,10) ; a blank GRAPHIC color bar GUICtrlSetResizing($mycolorLabel, $ws_sizebox);$GUI_DOCKMENUBAR);$GUI_DOCKAUTO) ;$GUI_DOCKBORDERS) GUICtrlSetBkColor($mycolorLabel,$sColorformFile) ; set the color for the label Specifically my issue is with that $mycolorLabel
      Thanks, Skysnake