faustf

login ebay site

10 posts in this topic

hi guy

 

i try  to create  a  script  for  login in website  ebay   https://signin.ebay.it/ws/eBayISAPI.dll?SignIn&UsingSSL=1&pUserId=&co_partnerId=2&siteid=101&ru=http%3A%2F%2Fmy.ebay.it%2Fws%2FeBayISAPI.dll%3FMyEbayBeta%26MyEbay%3D%26gbh%3D1%26guest%3D1&pageType=3984

the script not  work , but  i dont understund  where is the  error  someone  , could help me ??

#cs ----------------------------------------------------------------------------

    AutoIt Version: 3.3.12.0
    Author:         myName

    Script Function: ebay login multi
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <WinAPIFiles.au3>
#include <array.au3>
#include <File.au3>
#include <GuiIPAddress.au3>
#include <GuiListView.au3>
#include <WinAPI.au3>
#include <WinAPIShellEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>



Opt("GuiOnEventMode", 1)
Opt("GUICloseOnESC", 0)
Opt("GUIResizeMode", 128)


Global $Button1, $Combo1, $hFileOpen_nomi_login, $user, $password
Global $path_nomi = @ScriptDir & "\config\nomi.txt"
;--------------------  variabili inerazione pagina web ------------------
Global $oIE
Global $ebay_site = "https://signin.ebay.it/ws/eBayISAPI.dll?SignIn&UsingSSL=1&pUserId=&co_partnerId=2&siteid=101&ru=http%3A%2F%2Fmy.ebay.it%2Fws%2FeBayISAPI.dll%3FMyEbayBeta%26MyEbay%3D%26gbh%3D1%26guest%3D1&pageType=3984"
;---------------------------------------------------------------------------------------------------------------------


If ProcessExists("iexplore.exe") Then ; Check if the internet esplorer process is running.
    ProcessClose("iexplore.exe")
EndIf

_GUI()



Func _GUI()

    $Form1 = GUICreate("ebau", 1374, 736, 192, 114)

    $MenuItem1 = GUICtrlCreateMenu("&File")
    $MenuItem4 = GUICtrlCreateMenuItem("Sound", $MenuItem1)
    $MenuItem3 = GUICtrlCreateMenuItem("", $MenuItem1)
    $MenuItem2 = GUICtrlCreateMenuItem("Esci", $MenuItem1)
    $MenuItem5 = GUICtrlCreateMenu("&Help")
    $MenuItem6 = GUICtrlCreateMenuItem("R.I.P.", $MenuItem5)

    $Group1 = GUICtrlCreateGroup("", 0, 0, 1372, 713)
    $Combo1 = GUICtrlCreateCombo("", 32, 40, 185, 25);, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
    $Label1 = GUICtrlCreateLabel("Utenti ebay Login", 34, 19, 87, 17)
    $Button1 = GUICtrlCreateButton("Button1", 240, 24, 37, 37, $BS_ICON)
    GUICtrlSetImage(-1, @ScriptDir & "\icon\Chrisbanks2-GCons-Ebay.ico", -1)
    GUICtrlCreateGroup("", -99, -99, 1, 1)

    _popola_combo()

    GUISetState(@SW_SHOW)

    GUISetOnEvent($GUI_EVENT_CLOSE, "_close")
    GUICtrlSetOnEvent($MenuItem4, "_sound")
    GUICtrlSetOnEvent($MenuItem6, "_morto_del_mese")
    GUICtrlSetOnEvent($MenuItem2, "_close")
    GUICtrlSetOnEvent($Button1, "_login")

EndFunc   ;==>_GUI



Func _login()
;----------------- lettura credenziali per login  ---------------------------------------------

    Local $z
    Local $combo_name = GUICtrlRead($Combo1)
    _apertura_file_nomi()

    Local $tot_linee = _FileCountLines($path_nomi)

    For $i = 0 To $tot_linee - 1
        Local $nomi_extract = FileReadLine($path_nomi, $i)
        Local $verifica_nome = StringInStr($nomi_extract, $combo_name)

        If $verifica_nome <> 0 Then
            $z = $i
            $z += 1
            $user = FileReadLine($path_nomi, $z)
            $z += 1
            $password = FileReadLine($path_nomi, $z)
        EndIf
    Next

;------------------------- login vera  e propia per sito ebay  --------------------------------


    $oIE = _IECreate($ebay_site, 0, 1, 1, 1)
    _IELoadWait($oIE)
    Local $sText = _IEBodyReadHTML($oIE)
    ;_File_write_fast(@ScriptDir&"\html.txt",$sText)
    Local $aArray_user_pass = StringRegExp($sText, '(?is)" class="fld" id="(.*?)"', $STR_REGEXPARRAYGLOBALMATCH)


    ;Local $oForm = _IEGetObjById ($oIE, "sgnTab")
    Local $username = _IEFormElementGetObjByName($oIE, $aArray_user_pass[0])
    ;_IEFormElementSetValue($username, "2354191001")
    _IEFormElementSetValue($username,$user)
    Local $pass = _IEFormElementGetObjByName($oIE,$aArray_user_pass[1])
    ;_IEFormElementSetValue($pass, "friendly12@")
    _IEFormElementSetValue($pass, $password)
    Local $bottone = _IEFormElementGetObjByName($oIE, $password)
    _IEAction($bottone, "Click")
    _IELoadWait($oIE)


EndFunc   ;==>_login


Func _popola_combo()
    _apertura_file_nomi()

    Local $tot_linee = _FileCountLines($path_nomi)

    For $i = 0 To $tot_linee - 1
        Local $nomi_extract = FileReadLine($path_nomi, $i)
        Local $verifica_nome = StringInStr($nomi_extract, "_")
        If $verifica_nome <> 0 Then
            GUICtrlSetData($Combo1, $nomi_extract)
        EndIf
    Next

        FileClose($hFileOpen_nomi_login)
EndFunc   ;==>_popola_combo

Func _apertura_file_nomi()

    $hFileOpen_nomi_login = FileOpen($path_nomi, $FO_READ)
    If $hFileOpen_nomi_login = -1 Then
        MsgBox($MB_SYSTEMMODAL, "", "An error occurred when reading the file.")
        Return False
    EndIf
EndFunc   ;==>_apertura_file_nomi


;================================================================================================================


; #FUNCTION# ====================================================================================================================
; Author ........: faustf
; Modified.......:
; What do........: crea txt con link dei menu
; ===============================================================================================================================
Func _File_write_fast($sFilePath, $sFlieTxt)
    ConsoleWrite('@@ (1245) :(' & @MIN & ':' & @SEC & ') _crea_txt_menu()' & @CR) ;### Function Trace

    $file = FileOpen($sFilePath, 1)
    FileWrite($file, $sFlieTxt & @CR)
    FileClose($file)

EndFunc   ;==>_crea_txt_menu



Func _morto_del_mese()
    ShellExecute("www1.ilmortodelmese.com")
    If @error Then MsgBox($MB_ICONERROR, 'ERROR', 'Errore inaspettato !!')
EndFunc   ;==>_morto_del_mese

Func _sound()
    _IECreate("https://www.youtube.com/watch?v=vifsqv_QXB0", 1, 0, 0)
EndFunc   ;==>_sound


Func _close()
    Exit
EndFunc   ;==>_close

;===============================================================

;Keep the GUI alive

;===============================================================

While 1
    Sleep(1000)
WEnd

 

Share this post


Link to post
Share on other sites



because  i want creat  app for  insert  product  , and  first step is  login    :)

 

Share this post


Link to post
Share on other sites

Your script has absolute no error checking. So you do not know where something is going wrong. Every _IE* function sets @error which you then need to check in your script.
Without error checking you can only tell "the script not  work". But that is not enough for us to help you!


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-02-03 - Version 1.4.7.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

in practical   the  script  must  insert  user  and  password   and  click butto submit  ,  in ebay  login mask  ,  but  not  do

i have  this  code  in  console 

>Running:(3.3.12.0):C:\Program Files\AutoIt3\autoit3.exe "F:\ebay_app\ebay_multi_user_login\ebay_multi.au3"    
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
--> IE.au3 T3.0-1 Error from function _IEFormElementGetObjByName, $_IESTATUS_InvalidObjectType
--> IE.au3 T3.0-1 Error from function _IEFormElementSetValue, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-1 Error from function _IEFormElementGetObjByName, $_IESTATUS_InvalidObjectType
--> IE.au3 T3.0-1 Error from function _IEFormElementSetValue, $_IESTATUS_InvalidDataType
--> IE.au3 T3.0-1 Error from function _IEFormElementGetObjByName, $_IESTATUS_InvalidObjectType
--> IE.au3 T3.0-1 Error from function _IEAction(Click), $_IESTATUS_InvalidDataType
+>10:54:57 AutoIt3.exe ended.rc:0
+>10:54:57 AutoIt3Wrapper Finished.
>Exit code: 0    Time: 13.13

 

Share this post


Link to post
Share on other sites

You need to pass the form object to _IEFormElementGetObjByName not the IE object.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-02-03 - Version 1.4.7.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

i dont  understund  can  you   give me some example??? thankz

 

Share this post


Link to post
Share on other sites
28 minutes ago, faustf said:

i dont  understund  can  you   give me some example???

The authors of help have done this job already just look at example for _IEFormElementGetObjByName.

Share this post


Link to post
Share on other sites

The next best thing to explaining what causes your problm would be to write the correct code for you. But that will never happen. We teach people to fish and do not spoon feed them.
So you need to read the help file (as suggested by AutoBert) and you soon will see how to solve your problem - and you have learned something new. This would not happen if we wrote the code for you ;)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-02-03 - Version 1.4.7.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#10 ·  Posted

ok thankz   :) i   tryed   :)

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now