Jump to content

Extract specific field from IE page


Recommended Posts

Hi guys,

I'm trying to create a script that goes to

http://www8.tax.ny.gov/UTLR/utlrHome
enters information, then assigns the "Jurisdiction Code" to a variable.

My understanding is, the Jurisdiction Code is in a table. However, I can't figure out how to extract it.

I looked into:

_IETableGetCollection
_IETableWriteToArray

But couldn't figure it out.

Can anyone point me in the right direction?

Below is my current code.

Thanks!

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

$oIE = _IECreate()
_IENavigate($oIE, "http://www8.tax.ny.gov/UTLR/utlrHome")

$o_form = _IEFormGetObjByName($oIE, "UTLRForm")
$o_addr = _IEFormElementGetObjByName($o_form, "UTLR_STREETADDRESS_KEY")
$o_zip = _IEFormElementGetObjByName($o_form, "UTLR_ZIPCODE_KEY")
$o_type = _IEFormElementGetObjByName($o_form, "UTLR_SERVICETYPE_KEY")


_IEFormElementSetValue($o_addr, "136 Maple Avenue")
_IEFormElementSetValue($o_zip, "10952")
_IEFormElementSetValue($o_type, "Residential energy services")
_IEFormSubmit($o_form)
Edited by tes5884
Link to comment
Share on other sites

This function, _IETableWriteToArray, may be useful here.

When I tried that, ArrayDisplay only showed 2 tables, it never got down to the table I actually need.

Also, assuming I got to the right table, how do I select the specific cell/s.

$oTable=_IETableGetCollection($oIE,1)

$aTableData=_IETableWriteToArray($oTable,True)

_ArrayDisplay($aTableData)

Thanks taking the time to help me!

Edited by tes5884
Link to comment
Share on other sites

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

$oIE = _IECreate()
_IENavigate($oIE, "http://www8.tax.ny.gov/UTLR/utlrHome")

$o_form = _IEFormGetObjByName($oIE, "UTLRForm")
$o_addr = _IEFormElementGetObjByName($o_form, "UTLR_STREETADDRESS_KEY")
$o_zip = _IEFormElementGetObjByName($o_form, "UTLR_ZIPCODE_KEY")
$o_type = _IEFormElementGetObjByName($o_form, "UTLR_SERVICETYPE_KEY")


_IEFormElementSetValue($o_addr, "136 Maple Avenue")
_IEFormElementSetValue($o_zip, "10952")
_IEFormElementSetValue($o_type, "Residential energy services")
_IEFormSubmit($o_form)

$aJurisdictionCodes=StringRegExp(_IEBodyReadText ( $oIE ),'Jurisdiction code:(.*)',3)
_ArrayDisplay($aJurisdictionCodes)

Edited by DicatoroftheUSA
Link to comment
Share on other sites

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

$oIE = _IECreate()
_IENavigate($oIE, "http://www8.tax.ny.gov/UTLR/utlrHome")

$o_form = _IEFormGetObjByName($oIE, "UTLRForm")
$o_addr = _IEFormElementGetObjByName($o_form, "UTLR_STREETADDRESS_KEY")
$o_zip = _IEFormElementGetObjByName($o_form, "UTLR_ZIPCODE_KEY")
$o_type = _IEFormElementGetObjByName($o_form, "UTLR_SERVICETYPE_KEY")


_IEFormElementSetValue($o_addr, "136 Maple Avenue")
_IEFormElementSetValue($o_zip, "10952")
_IEFormElementSetValue($o_type, "Residential energy services")
_IEFormSubmit($o_form)

$aJurisdictionCodes=StringRegExp(_IEBodyReadText ( $oIE ),'Jurisdiction code:(.*)',3)
_ArrayDisplay($aJurisdictionCodes)

Thank you DicatoroftheUSA.

I need to do some google'ing, so I can understand what you just did. But, that seems to work!!

Link to comment
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
 Share

  • Recently Browsing   0 members

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