Sign in to follow this  
Followers 0
jharmon

Field info

6 posts in this topic

I have my script waiting for an IE form to load, and once it is loaded I want to create a variable set to a field in the IE form so I can use that text elsewhere. In the source code, the field is named SERVICE_NO. Initially, I thought that I would just be able to make IE visible and set $var = .service_no.value, but that doesn't work. I have messed around with _IEBodyReadHTML(), but I'm not sure if I am misusing that. Does anyone have any suggestions? Thanks.

Share this post


Link to post
Share on other sites



Your logic is correct. Here is an example using IE.au3 to obtain the current form field value:

#include <IE.au3>

$oIE = _IECreate()
_IENavigate($oIE, "http://www.google.com")

$oForm = _IEFormGetObjByName($oIE, "f")
$oQuery = _IEFormElementGetObjByName($oForm, "q")
$oQuery.focus

Send("This is a test")
Sleep(2000); Allow Send time to complete

$sQueryValue = $oQuery.value

ConsoleWrite ("Field Value is: " & $sQueryValue & @CR)

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

#3 ·  Posted (edited)

Pardon my ignorance, but what are "f" and "q"? Are they the names of the forms?

$oForm = _IEFormGetObjByName($oIE, "f")

$oQuery = _IEFormElementGetObjByName($oForm, "q")

Edited by jharmon

Share this post


Link to post
Share on other sites

Pardon my ignorance, but what are "f" and "q"? Are they the names of the forms?

$oForm = _IEFormGetObjByName($oIE, "f")

$oQuery = _IEFormElementGetObjByName($oForm, "q")

Yes. Take a look at the source for http://www.google.com and you'll see they are the names of the form (f) and the text field (q).

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

I incorporated the example provided, but now when I'm running my script, I get the following error pointing to IE.au3:

C:\Program Files\AutoIt3\Include\IE.au3 (728) : ==> Variable must be of type "Object".:

If IsObj($o_object.document.forms.item ($s_name, $i_index)) Then

If IsObj($o_object^ ERROR

I am running the latest beta and have IE.au3 T1.4. Any suggestions?

Share this post


Link to post
Share on other sites

I incorporated the example provided, but now when I'm running my script, I get the following error pointing to IE.au3:

C:\Program Files\AutoIt3\Include\IE.au3 (728) : ==> Variable must be of type "Object".:

If IsObj($o_object.document.forms.item ($s_name, $i_index)) Then

If IsObj($o_object^ ERROR

I am running the latest beta and have IE.au3 T1.4. Any suggestions?

It is telling you that there is a problem with the object variable you passed into the _IEFormGetObjByName routine (first parameter) -- it is either not an object or it is not the right type of object. It needs to be the variable you create with something like $oIE = _IECreate()

If this doesn't clear it up for you you'll need to provide more code to show what you're doing.

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

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