Jump to content

Recommended Posts

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
Posted

And your question is?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

 

Posted

Impossible to tell without having seen the code.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.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 (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

 

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
Posted

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 2024-07-28 - Version 1.6.3.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 (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

 

Posted

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 2024-07-28 - Version 1.6.3.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 (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

 

Posted

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.

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.

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
×
×
  • Create New...