Sign in to follow this  
Followers 0
Mithrandir

read excel data and enter them into a web form

1 post in this topic

#1 ·  Posted (edited)

I'm trying to create a script that read the cells from an excel file and enter the content of them in a web form. The doubts I have are:

1) I want to enter data which are in different columns separated by a space and what I did was to put a blank column and then when filling in the form join the variables with which I read every column. I do not know if have to define a new variable that is the union of the variables with which I read every column and then fill out the form with that variable.

2) I want to reconnect to the Internet after each web form submit. I made a macro using the mouseless browsing plugin for firefox (I have dynamic ip and router) but I have to leave time to wait for a new ip. Are there any command or macro to reconnect to the internet in autoit?

3) Is there a command to check there is internet connection in order to continue the execution of the script (I thought of an If but what I want is to wait until there is connection)?

Here It is the code (the web is a random blogger example blogger, I already know how to submit the form and all that)

#include <IE.au3>
#include <Excel.au3>

$oIE = _IECreate ("http://www.blogger.com/post-create.g?blogID=*******")

$sFilePath1 = "C:\Documents and Settings\Pablo\Mis documentos\Libro1.xls"

$oExcel = _ExcelBookOpen($sFilePath1)

For $i = 1 To 3 ;Loop

    $sCellValue = _ExcelReadCell($oExcel, $i, 1);cell with text

    $sCellValue2 = _ExcelReadCell($oExcel, $i, 2);cell in blank in order to have an space

    $sCellValue3 = _ExcelReadCell($oExcel, $i, 3);cell with text

    _ExcelReadCell($oExcel, $i, 1)

    _ExcelReadCell($oExcel, $i, 2)

    _ExcelReadCell($oExcel, $i, 3)

$oForm = _IEFormGetCollection ($oIE, 0)

$oQuery = _IEFormElementGetCollection ($oForm, 6)

_IEFormElementSetValue ($oQuery, $sCellValue&$sCellValue2&$sCellValue3);I join $sCellValue (text) with $sCellValue2 (blank space) with $sCellValue3 (text). Can I do this?

_IEFormSubmit ($oForm)

Run("C:\Documents and Settings\Pablo\Mis documentos\reconectador del router2.exe");this is the macro that reconnects to internet.

Sleep(240000)

_IENavigate($oIE,"http://www.blogger.com/post-create.g?blogID=*******")

Next

Thanks for your help!

Edited by Mithrandir

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
Sign in to follow this  
Followers 0