Sign in to follow this  
Followers 0
DJM

IE TableGet and hidden values

5 posts in this topic

I am new to scripting!

Am trying to lift field values from an IE application, and paste them into a different database application. The values are visible to me on the IE application. When I view the source, I find:

</tr>

</table>

<input type="hidden" name="REF_ACCTNM_HIDDEN" value="000000123456">

<input type="hidden" name="REF_CUST_AGE_HIDDEN" value="61">

<input type="hidden" name="REF_CUST_NM_HIDDEN" value="BUSH, GEORGE">

<input type="hidden" name="REF_CUST_ADDR_HIDDEN" value="1600 PENNSYLVANIA AVE">

<input type="hidden" name="REF_CUST_CITY_HIDDEN" value="WASHINGTON">

<input type="hidden" name="REF_CUST_STATE_HIDDEN" value="DC">

<input type="hidden" name="REF_CUST_DOB_HIDDEN" value="1946-07-06">

<input type="hidden" name="REF_CUST_GENDER_HIDDEN" value="M">

<input type="hidden" name="REF_CUST_HOME_PHONE_HIDDEN" value="202-456-1111">

<input type="hidden" name="REF_CUST_WORK_PHONE_HIDDEN" value="">

<input type="hidden" name="REF_CUST_ZIP_HIDDEN" value="20500">

I want to lift those values and transfer them. I patched this together using the HelpFiles:

CODE
#include <IE.au3>

#include <Array.au3>

$oIE = _IEAttach ("Detailed Internal Referral")

$oTable = _IETableGetCollection ($oIE, 2)

$aTableData = _IETableWriteToArray ($oTable)

_ArrayDisplay($aTableData, "Eref Data Table", 1, 1) ; [2D, transposed]

ArrayDisplay gives me a table with headings, but "0" or " " instead of the values.

I tried:

Opt("WinDetectHiddenText", 1)

It didn't help.

I would appreciate help with the next step.

DJM

Share this post


Link to post
Share on other sites



What you show above is not in a table...

try this...

$oInput = _IEGetObjByName($oIE, "REF_ACCTNM_HIDDEN")

$value = _IEFormElementGetValue($oInput)

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

What you show above is not in a table...

try this...

$oInput = _IEGetObjByName($oIE, "REF_ACCTNM_HIDDEN")

$value = _IEFormElementGetValue($oInput)

Dale

Thanks Dale!

That did the trick. The script below accomplishes my first step.

CODE
#include <IE.au3>

$oIE = _IEAttach("Detailed Internal Referral")

$oInput1 = _IEGetObjByName($oIE, "REF_ACCTNM_HIDDEN")

$acct = _IEFormElementGetValue($oInput1)

$oInput2 = _IEGetObjByName($oIE, "REF_CUST_AGE_HIDDEN")

$age = _IEFormElementGetValue($oInput2)

$oInput3 = _IEGetObjByName($oIE, "REF_CUST_NM_HIDDEN")

$name = _IEFormElementGetValue($oInput3)

$oInput4 = _IEGetObjByName($oIE, "REF_CUST_ADDR_HIDDEN")

$address = _IEFormElementGetValue($oInput4)

$oInput5 = _IEGetObjByName($oIE, "REF_CUST_CITY_HIDDEN")

$city = _IEFormElementGetValue($oInput5)

$oInput6 = _IEGetObjByName($oIE, "REF_CUST_STATE_HIDDEN")

$state = _IEFormElementGetValue($oInput6)

$oInput7 = _IEGetObjByName($oIE, "REF_CUST_DOB_HIDDEN")

$dob = _IEFormElementGetValue($oInput7)

$oInput8 = _IEGetObjByName($oIE, "REF_CUST_GENDER_HIDDEN")

$gender = _IEFormElementGetValue($oInput8)

$oInput9 = _IEGetObjByName($oIE, "REF_CUST_HOME_PHONE_HIDDEN")

$homephone = _IEFormElementGetValue($oInput9)

$oInput10 = _IEGetObjByName($oIE, "REF_CUST_WORK_PHONE_HIDDEN")

$workphone = _IEFormElementGetValue($oInput10)

$oInput11 = _IEGetObjByName($oIE, "REF_CUST_ZIP_HIDDEN")

$zip = _IEFormElementGetValue($oInput11)

MsgBox(0, "Eref_data", "Account #: " & $acct & @CRLF & "Age: " & $age & @CRLF & "Name: " & $name & @CRLF & "Address: " & $address & @CRLF & "City: " & $city & @CRLF & "State: " & $state & @CRLF & "Zip: " & $zip & @CRLF & "DOB: " & $dob & @CRLF & "Gender: " & $gender & @CRLF & "Phone: " & $homephone)

It's kind of brute force_ish. I got the feeling from the helpfile that $oInput is not a simple variable (object variable?). Is there some kind of array statement that can clean it up and reduce the number of lines?

Thanks,

DJM

Share this post


Link to post
Share on other sites

You can use _IEFormElementGetCollection or _IETagNameGetCollection and then loop through the collection with a For Next loop, but based on your question about the object variable I'd suggest you ease into all of this and not worry about creating the most efficient code until you master more of the COM concepts.

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Share this post


Link to post
Share on other sites

You can use _IEFormElementGetCollection or _IETagNameGetCollection and then loop through the collection with a For Next loop, but based on your question about the object variable I'd suggest you ease into all of this and not worry about creating the most efficient code until you master more of the COM concepts.

Dale

Well put. Thanks for the help!

DJM

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
Sign in to follow this  
Followers 0