Jump to content

Recommended Posts

Posted
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
Posted
Posted
  On 1/23/2016 at 7:31 PM, 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

Expand  

 

Posted

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?"

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

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)

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:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

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:

  Reveal hidden contents

 

Posted

Select the field where you need to enter the date.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted
</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>

 

Posted

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

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

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 .

Posted

_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:

  Reveal hidden contents

 

Posted

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.

Posted

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:

  Reveal hidden contents

 

Posted

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:

  Reveal hidden contents

 

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
  • Recently Browsing   0 members

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