Sign in to follow this  
Followers 0
Gokul

Sometimes data from excel are not populated on the application

9 posts in this topic

#1 ·  Posted (edited)

Hi,

When i read the values from excel, sometimes the values are not displayed on the application against the corresponding fields. The fields gets focus and focus moves to the next fields, but the values are not displayed on the fields. I have a combobox in the application. After reaching the combobox, the values gets populated from the next field onwards. Sometimes all the fields before and after the combobox gets filled with data. All the rows in the excel are of the same format. Why is it happening so?

Edited by Gokul

Share this post


Link to post
Share on other sites



And your question is?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.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
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

And your question is?

Why is it happening so?

Share this post


Link to post
Share on other sites

Impossible to tell without having seen the code.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.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
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Impossible to tell without having seen the code.

#include <excel.au3>
#include <array.au3>

$file ='EXCEL PATH'

$oExcel = _ExcelBookOpen($file, 0)

_ExcelSheetActivate($oExcel, "Data")

$aArray = _ExcelReadSheetToArray($oExcel, 1)

_ArrayDisplay($aArray, "Array using Default Parameters")

Run('application path')

_WinWaitActivate(" Login","")

ControlClick(" Login to application", "", "NAME:Username")

Send("user1")

Send("{TAB}")

Sned("pass1")

ControlClick(" Login to application", "", "[NAME:Submit]")

$idno = $aArray[$i][1]
$name1 = $aArray[$i][2]
$name2 = $aArray[$i][3]
$name3 = $aArray[$i][4]
$email1 = $aArray[$i][5]
$email2 = $aArray[$i][6]
$email3 = $aArray[$i][7]
$address1 = $aArray[$i][8]
$address2 = $aArray[$i][9]
$address3 = $aArray[$i][10]
$State1 = $aArray[$i][11]
$country1 = $aArray[$i][12]
$ph1 = $aArray[$i][13]
$ph2 = $aArray[$i][14]
$fax1 = $aArray[$i][15]
$gender = $aArray[$i][16]
$officeaddress1 = $aArray[$i][17]
$officeaddress2 = $aArray[$i][18]
$officeaddress3 = $aArray[$i][19]
$ph3 = $aArray[$i][20]
$ph4 = $aArray[$i][21]
_WinWaitActivate("Emp details","")
MsgBox("Ok","Confirmation","Click Ok to begin...")
ControlClick("Emp details", "", "[NAME:idno]")
Send($idno)
ControlClick("Emp details", "", "[NAME:firstname]")
Send($name1)
ControlClick("Emp details", "", "[NAME:middlename]")
Send($name2)
ControlClick("Emp details", "", "[NAME:lastname]")
Send($name3)
ControlClick("Emp details", "", "[NAME:primaryemail]")
Send($email1)
ControlClick("Emp details", "", "[NAME:confirmemail]")
Send($email2)
ControlClick("Emp details", "", "[NAME:secondaryemail]")
Send($email3)
ControlClick("Emp details", "", "[NAME:addressline1]")
Send($address1)
ControlClick("Emp details", "", "[NAME:addressline2]")
Send($address2)
ControlClick("Emp details", "", "[NAME:addressline3]")
Send($address3)
ControlClick("Emp details", "", "[NAME:state]")
Send($state1)
ControlClick("Emp details", "", "[NAME:country]")
Send($country)
ControlClick("Emp details", "", "[NAME:mobno]")
Send($ph1)
ControlClick("Emp details", "", "[NAME:landno]")
Send($ph2)
ControlClick("Emp details", "", "[NAME:fax]")
Send($fax1)
MouseClick("left",'coordinate',$gender,1)
ControlClick("Emp details", "", "[NAME:offaddressline1]")
Send($officeaddress1)
ControlClick("Emp details", "", "[NAME:offaddressline2]")
Send($officeaddress2)
ControlClick("Emp details", "", "[NAME:offaddressline3]")
Send($officeaddress3)
ControlClick("Emp details", "", "[NAME:phone1]")
Send($ph3)
ControlClick("Emp details", "", "[NAME:phone2]")
Send($ph4)

MsgBox("Ok","Confirmation","Alert")
_ExcelBookClose($oExcel, 0, 0)
$oExcel = '';
Next

Gender is the combobox i have mentioned in the question.

Edited by Gokul

Share this post


Link to post
Share on other sites

You need to add some error checking to your code.

Every AutoIt function either returns a value (see the help file for the corresponding function) or sets macro @error in case of an error.

Write the error code plus line where it happened to the Console.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.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
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

BTW:

Could you please enclose your code in AutoIt tags (the blue "A" in the editor)? Enhances readability ;)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.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
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

You need to add some error checking to your code.

Every AutoIt function either returns a value (see the help file for the corresponding function) or sets macro @error in case of an error.

Write the error code plus line where it happened to the Console.

There are no errors, and this happens only sometimes. When i click on the application window, each time before the values are taken from excel, then all the fields gets populated accordingly else, sometimes some fields miss to get populated with data.

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

You go through all the trouble of the control functions, and don't use controlsettext?

Don't use send.

Also, don't use controlclick to focus, you controlfocus.

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

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