Jump to content

Recommended Posts

Posted

i am using this code for filling text box of IE : 

#include <IE.au3>

Func Quit()
    Exit
 EndFunc
$oIE = _IEAttach ("Home")
_IELoadWait($oIE)

Local $oStockKg = _IEGetObjById($oIE, "txtbuyingstockinkg0")
If IsObj($oStockKg) And StringStripWS($oStockKg.Value, 8) = "" Then
Local $iOutStanding, $iKg, $iGram, $oStockKg, $oStockGram, $sStockKg, $sStockGram
Local $oTds, $oTrs = _IETagNameGetCollection($oIE, "tr")
If IsObj($oTrs) Then
    For $i = 1 To $oTrs.Length
        $oTr = $oTrs($i)
        $oTds = _IETagNameGetCollection($oTr, "td")
        If IsObj($oTds) And $oTds.Length = 5 Then
            $iOutStanding = $oTds(1).InnerText
            $iKg = StringLeft($iOutStanding, StringInStr($iOutStanding, ".")-1)
            $iGram = StringTrimLeft($iOutStanding, StringInStr($iOutStanding, "."))
            $sStockKg = $oTds(3).FirstElementChild.getAttribute("id", 2)
            $oStockKg = _IEGetObjById($oIE, $sStockKg)
            If IsObj($oStockKg) Then
            $oStockKg.Value = $iKg
            _IEAction($oStockKg, "Click")
            EndIf
            $sStockGram = $oTds(4).FirstElementChild.getAttribute("id", 2)
            $oStockGram = _IEGetObjById($oIE, $sStockGram)
            If IsObj($oStockGram) Then
               $oStockGram.Value = $iGram
               _IEAction($oStockGram, "Click")
               EndIf
        EndIf
    Next
 $btnnext = _IEGetObjById($oIE,"btnnext")
_IEAction($btnnext,"click")
EndIf
EndIf
Exit

But i want to check every input box and fill the only empty inputbox like sugar and oil, and skip wheat and Toor Dal. Becuase they have already text.

fps autoit help.jpg

Posted (edited)

@Nine error in line 29.

My code is : 

#include <IE.au3>

Func Quit()
    Exit
 EndFunc
$oIE = _IEAttach ("Home")
_IELoadWait($oIE)

Local $oStockKg = _IEGetObjById($oIE, "txtbuyingstockinkg0")
If IsObj($oStockKg) And StringStripWS($oStockKg.Value, 8) = "" Then
Local $iOutStanding, $iKg, $iGram, $oStockKg, $oStockGram, $sStockKg, $sStockGram
Local $oTds, $oTrs = _IETagNameGetCollection($oIE, "tr")
If IsObj($oTrs) Then
    For $i = 1 To $oTrs.Length
        $oTr = $oTrs($i)
        $oTds = _IETagNameGetCollection($oTr, "td")
        If IsObj($oTds) And $oTds.Length = 5 Then
            $iOutStanding = $oTds(1).InnerText
            $iKg = StringLeft($iOutStanding, StringInStr($iOutStanding, ".")-1)
            $iGram = StringTrimLeft($iOutStanding, StringInStr($iOutStanding, "."))
            $sStockKg = $oTds(3).FirstElementChild.getAttribute("id", 2)
            $oStockKg = _IEGetObjById($oIE, $sStockKg)
            If IsObj($oStockKg) Then
            If $oStockKg.Value <> "" then ContinueLoop  ;  <======== add this line
            $oStockKg.Value = $iKg
            _IEAction($oStockKg, "Click")
            EndIf
            EndIf
            $sStockGram = $oTds(4).FirstElementChild.getAttribute("id", 2)
            $oStockGram = _IEGetObjById($oIE, $sStockGram)
            If IsObj($oStockGram) Then
               $oStockGram.Value = $iGram
               _IEAction($oStockGram, "Click")
               EndIf
    Next
EndIf
EndIf

errpr.JPG

Edited by Nareshm
adding code
Posted (edited)

@Nine Thank you, working perfect, its my mistake because i added two time endif in line 27.

but i need little more help, i want to check all outstanding amount if outstanding amount value of all scheme are 0.000 then i want click on new bill then exit script.

I tried with this code :

Local $oTds = _IETagNameGetCollection($oIE, "td")
For $oTd In $oTds
If $oTd.InnerText = "0.000" Then
_IEAction(_IEGetObjById($oIE,"lnkbill"),"click")
Exit
endIf
Next

But it was checking only one scheme.

*sorry for my bad english.* 

Edited by Nareshm
for adding _IEAction line in script
  • 3 weeks later...

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