Jump to content

Recommended Posts

Posted (edited)

Hola Chicos soy nuevo en el tema, quisiera que me ayuden.

I want to click the button depending on the number that appears in front

 

I  Have:

Local $oTableCollection = _IETableGetCollection($oIE )

    For $oAll In $oTableCollection
        $aTableData = _IETableWriteToArray($oAll, True)
        For $i = 1 to 100
            if $aTableData[$i][2] = "1084552701" Then
                MsgBox(0,"",$aTableData[$i][2])
                $Datos = _IETagNameGetCollection($oIE, "span")
                For $oSpan In $Datos
                If $oSpan.innerText = "description" Then
                    _IEAction($oSpan, 'click')
                    ExitLoop
                ElseIf $oSpan =0 Then
                    MsgBox(0,"Error","l")
                    _Parar()
                EndIf
                Next

                   $lista = _ArrayDisplay($Datos)
                ;_IEAction($oSpan, 'click')
                ;_IEAction($Edit, 'Focus')
            EndIf

        Next
    Next

 

Screenshot_2.thumb.jpg.87a2e084f62651e793c3ced500312ef2.jpg

Edited by Melba23
Added code tags
Posted

Very hard to help you with the provided informations.  First give full runable snippet of your script.  We will probably need to access the web site that gives you problem.  At the very minimum, post DOM of the part you have problem with.

Posted (edited)


This is the best thing that I have achieved .. it works but I don't think it's the best way

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

Global  $oIE = _IECreate("https://psi.icbf.gov.co/entregaraciones/seguimiento",1)

Local $oTableCollection = _IETableGetCollection($oIE,0 )

Local $oSpans = _IETagNameGetCollection($oIE, "span")


$aTableData = _IETableWriteToArray($oTableCollection,True)

        For $i = 1 to 100
            if $aTableData[$i][2] = "1030002000" Then
                For $oSpan In $oSpans
                    If $oSpan.innerText = "description" Then
                        $item = $oSpans(42+$i)
                        _IEAction($item, "click")
                        ExitLoop
                    ElseIf $oSpan =0 Then
                    MsgBox(0,"Error","Hubo un problema al seleccionar la Regional")
                    EndIf
                Next
            EndIf

        Next

  

Edited by Melba23
Added code tags
Posted

Seems to be good code. Why do you think it's not the best way?

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted

We cannot access the web site.  Hard to tell if there is a better way to achieve what you are trying to do.  As @careca said, at first glance, your code seems to be alright.  Try to remove hard coded data (like for example, 100 in the for loop.  Use ubound function instead).

Posted (edited)

thaks!!! Ubound is Better

$Row = $oExcel_1.ActiveCell.Row; Recalcula fila Actual
$Id_Beneficiario= _Excel_RangeRead($wkbook, Default, "B" & $Row,True)

         $Y = 0
        For $i = 1 to UBound($aTableData)-1
            if $aTableData[$i][2] = $Id_Beneficiario Then
                $Y=1
                For $oSpan In $oSpans
                    If $oSpan.innerText = "description" Then
                        $item = $oSpans(42+$i)
                        _IEAction($item, "click")
                        ExitLoop
                    ElseIf $oSpan =0 Then
                    MsgBox(0,"Error","Hubo un problema al seleccionar la Regional")
                    EndIf
                Next
            EndIf

         Next

        If $Y = 0  Then
          $msgBox = MsgBox(4,"Error","Beneficiario no encontrado por favor Verifique los números, Desea Reintentar?")
             If $msgBox = 6 Then
               Selecciona_Benef()

              _Seleccione()
            EndIf
        Else
        Cargar()
        EndIf

 

Edited by Melba23
Removed quote and added code tags
  • Moderators
Posted

alguty8712,

Welcome to the AutoIt forum.

A couple of points if I may:

- When you post code in future please use Code tags - see here how to do it.  Then you get a scrolling box and syntax colouring as you can see above now I have added the tags.

- When you reply in future, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - responders  know what they wrote (and translating it makes it even worse!) and it just pads the thread unnecessarily.

Thanks in advance for your cooperation.

M23

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

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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...