Jump to content

Auto Log In several sites from Excel


Recommended Posts

I'm trying to make an auto log in program. Concretely, I'd like to log me to social networks, mail box, etc. from an excel file with the following data:

- column A : the url fo these sites

- column B : my ID for each

- column C : password

I'd like my bot to read the information in column A, launch Internet Explorer (with an _IECreate) and then fil the form "ID" and "password" (by reading the information in column B and C). I'm ok with the "filling" part (there is a lot of tutorials on Youtube), but I have a problem when it comes to "read" the data in my excel file to reach the URL

I've written the following code :

#include <Excel.au3>

#include <IE.au3>

$oExcel = _Excel_Open()
$oFile = "C:\Desktop\Reminders.xlsx"
_Excel_BookOpen($oExcel, $oFile)
sleep(1000)
$url = _Excel_RangeRead($oExcel, 2, 1)
_IECreate("$url")

The problem is that my code is unable to actually read what is in the cell because when it launches IE, I land on http://$url/ file ... :/ 

Is _Excel_RangeRead the right function to do what I want ? I'm using autoit V3.3.14.1 (I don't have _excel_readcell in it).

Thank you for your help !

Link to comment
Share on other sites

This line is wrong

_IECreate("$url")

Try:

_IECreate($url)

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I think it should be something like this:
 

$oExcel = _Excel_Open() ;opens a new instance of the Excel software
$Workbook = _Excel_BookOpen($oExcel, "C:\Desktop\Reminders.xlsx")
$url = _Excel_RangeRead($Workbook, $Workbook.Activesheet, "A1", 1)
_IECreate($url)

Regards
Alien

Link to comment
Share on other sites

The cell reference needs to be a string:

$url = _Excel_RangeRead($oFile, Default, "A1")

Default means:

$Workbook.Activesheet

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

You're right, your solution works perfectly !! Thanks a lot @alien4u !

Now just one more thing : instead of writing A1 to log on the first site, and then A2 for the second, etc. until the site number N (N rows in my excel), I'd like to do a loop.

Do you know how to do it ? 

The idea would be the following loop :

$geturl = _Excel_RangeRead($oFile, $oFile.Activesheet, "A+$i")
$oIE = _IECreate($geturl)

Do you know how could I do it ?

Link to comment
Share on other sites

I think you should start to read the AutoIt help file to understand the basics of the language.
You put everything into a string - even the variable.

Should be:

$geturl = _Excel_RangeRead($oFile, $oFile.Activesheet, "A" & $i)

 

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...