Natalicio

AutoIT - Insert Data from an Excel cell in Calendar on the Internet

22 posts in this topic

Hello guys!
 
I have a question and need help.
There are two date fields on a page in Internet Explorer , open the AutoIt own . But these dates should be met through a cell determines an Excel file that contains this information .
The problem:
Inserting this date coming this cell ? Remembering that have to use the calendar because I can not edit in the box , selecting only the calendar.
 
Can you help me?
 
Junior

Share this post


Link to post
Share on other sites



Hi. what have you tried so far?

Saludos

Share this post


Link to post
Share on other sites
1 hour ago, Natalicio said:

Hello . Thank you for answering . I made an automation that opens a page and SAP will filling the field as sequence , but has two date format fields that only fills when you open the calendar next to each field. And I can only fill in this field through a particular cell in Excel that I have to seek and take up these dates fields. OF HOME AND DATE END DATE . Just do not get these last two fields

 

Share this post


Link to post
Share on other sites

With "What have you tried so far" Danyfirex means: "What have you coded so far to solve your problem and which errors do you get?"

1 person likes this

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

Hello Water , fill fields in an SAP screen, but when it comes in the date field he is disqualified by filling only through the calendar , but this date has to be filled through a specific excel cell. The following code so far .. I'm sorry you have primary mistakes , I am new to AutoIT...

 

#include <IE.au3>

$sUrl = "http://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
$oIE = _IECreate($sUrl, 0, 1, 0, 1)
Sleep(2000)
$oHWND = _IEPropertyGet($oIE, "hwnd")
WinSetState($oHWND, "", @SW_MAXIMIZE)

sleep(1000)

$oForm = _IEFormGetCollection($oIE,0)


$oUsername = _IEFormElementGetObjByName($oForm, "txtUserName")
$oPassword = _IEFormElementGetObjByName($oForm, "txtPassword")
$sUserName = "XXXX"
$sPassword = "111111"


_IEFormElementSetValue($oUsername, $sUsername)
_IEFormElementSetValue($oPassword, $sPassword)

sleep(2000)

;Clica-se no botão ENTER
send("{ENTER}")

;Outra manierade clicar no ENTER
Local $oSubmit = _IEGetObjByName($oIE, "btnSubmit")
_IEAction($oSubmit,"click")

_IELoadWait ($oIE)


With $oIE
    .fullscreen = True
    .Visible = True
EndWith
Func _WinWaitActivate($title,$text,$timeout=0)
        WinWait($title,$text,$timeout)
        If Not WinActive($title,$text) Then WinActivate($title,$text)
        WinWaitActive($title,$text,$timeout)
EndFunc

_WinWaitActivate("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","")
MouseMove(58,77)

Sleep(2000)
MouseClick( "Primary",53,247, 1)

Sleep(10000)
MouseClick( "Primary",473,195, 1)

Sleep(2000)
MouseClick( "Primary",271,258, 1)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Please read this;
How to post code on the forum

 

EDIT:
As I understand you want on a web page generated by SAP, fill out the form with the date.
The problem is that the field for entering the date is not easy to fulfill?
You should inspect this filed and show us the HTML snippet.

Edited by mLipok

Signature beginning:   Wondering who uses AutoIT and what it can be used for ?
* GHAPI UDF - modest begining - comunication with GitHub REST API *
ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button

Spoiler

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API *

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * 

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2017-06-04

Share this post


Link to post
Share on other sites

Hi, mLipok.

OK. But which part of the html code I have to offer ..?

Please...

Share this post


Link to post
Share on other sites

Press F12 in IE to start the DOM explorer when the page you want to automate is displayed.
This will display the relevant part of the HTML source code when you select an item of the page.


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

Hi, what part do you want?

Share this post


Link to post
Share on other sites

Hi, what part do you want?

Share this post


Link to post
Share on other sites

Select the field where you need to enter the date.


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
</td><td class="DynamicFilterAreaTableCellLabel" style="width:7%;"><span id="ctl00_FilterArea_Label2" class="span_label">DE:</span></td><td class="DynamicFilterAreaTableCellControl" style="width:7%;"><table id="ctl00_FilterArea_Table2" border="0">
                <tr>
                    <td style="width:5%;"><input name="ctl00$FilterArea$txtDataDe" type="text" value="24/01/2016" id="ctl00_FilterArea_txtDataDe" disabled="disabled" class="input_text" style="min-width:50px" /></td><td><input type="image" name="ctl00$FilterArea$dcDataDe_ImageButton" id="ctl00_FilterArea_dcDataDe_ImageButton" src="../../PortalResources/images/16x16/calendar.png" onclick="dcDataDe.showOrHide();return false;" style="border-width:0px;" /><input type="hidden" name="ctl00$FilterArea$dcDataDe_valueField" id="ctl00_FilterArea_dcDataDe_valueField" value="24/1/2016" /></td>
                </tr>
            </table></td><td class="DynamicFilterAreaTableCellLabel" style="width:7%;"><span id="ctl00_FilterArea_Label3" class="span_label">ATÉ:</span></td><td class="DynamicFilterAreaTableCellControl" style="width:7%;"><table id="ctl00_FilterArea_Table3" border="0">
                <tr>
                    <td><input name="ctl00$FilterArea$txtDataAte" type="text" value="24/01/2016" id="ctl00_FilterArea_txtDataAte" disabled="disabled" class="input_text" style="width:50px;" /></td><td><input type="image" name="ctl00$FilterArea$dcDataAte_ImageButton" id="ctl00_FilterArea_dcDataAte_ImageButton" src="../../PortalResources/images/16x16/calendar.png" onclick="dcDataAte.showOrHide();return false;" style="border-width:0px;" /><input type="hidden" name="ctl00$FilterArea$dcDataAte_valueField" id="ctl00_FilterArea_dcDataAte_valueField" value="24/1/2016" /></td>
                </tr>
            </table></td><td class="DynamicFilterAreaTableCellLabel" style="width:7%;"><span id="ctl00_FilterArea_Label4" class="span_label">STATUS:</span></td><td class="DynamicFilterAreaTableCellControl" style="width:7%;">
<div class="multiselectcontrol">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>

 

Share this post


Link to post
Share on other sites

You need to insert the date into the input fields now filled with "24/01/2016"?


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

What happens : The period of time is scheduled to begin in the present day , but I must get this value of a given cell in an Excel spreadsheet. For example : There are several dates in a particular column , so I must take the first date is just the start and the last date that is the end of the period .

Share this post


Link to post
Share on other sites

_Excel_RangeRead should do what you need. If you need to read column "B" then use:

#include <Array.au3>
#include <Excel.au3>
#include <MsgBoxConstants.au3>

; Create application object
Global $oExcel = _Excel_Open()
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
; Open the workbook
Global $oWorkbook = _Excel_BookOpen($oExcel, @ScriptDir & "\Extras\_Excel1.xls")
If @error Then
    MsgBox($MB_SYSTEMMODAL, "Error", "Error opening the workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    _Excel_Close($oExcel)
    Exit
EndIf
; Read column "B" of the active worksheet
Global $aResult = _Excel_RangeRead($oWorkbook, Default, "B:B")
_ArrayDisplay($aResult)

 


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

Ok , but have yet to see at what time I take the cell value to the DATE text box on page .. in fact where " 01.24.2016 " , the entry will be this cell value which is precisely the date the beginning of the period. And another testo DATA box is locked and value only comes when I select the calendar.

Share this post


Link to post
Share on other sites

The date fields in the web page are named "ctl00$FilterArea$txtDataDe" and "ctl00$FilterArea$txtDataAte". I assume there are many of them on the web page. So you need to retrieve all of them and loop through the returned collection.

BTW: A - anonymized - screenshot would be fine ;)


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

I'm trying and I'll tell you ...

Share this post


Link to post
Share on other sites

BTW: Do you have a SAPGUI available as well? There is a UDF available to automate the GUI - which might be easier.


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

hmmm .. interesting. Can offer me to try .. ?

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