Jump to content

Send command to a text field in IE 7 not working


Recommended Posts

I had a simple SEND command in a script that worked just fine in IE 6. I am using an INPUT BOX for the user to type in the text and capture the text in a variable. The script then tabs to the webpage text field and the SEND command inserts the captured text just fine.

In IE 7 the script tabs to the TEXT FIELD but the text I am trying to insert into the text field does not populate.

Any thoughts on what is different in IE 7 that I need to code around?

Link to comment
Share on other sites

try with _IE*, it's much stronger

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

try with _IE*, it's much stronger

Welcome to the Forums Dino24t,

To find these _IE* functions, take a look at the helpfile, and the are in the UDF part.

If you need any more help with the functions, just post again, with the code you have tried. :D

Link to comment
Share on other sites

Welcome to the Forums Dino24t,

To find these _IE* functions, take a look at the helpfile, and the are in the UDF part.

If you need any more help with the functions, just post again, with the code you have tried. :D

Thanks...I had seen these in the help before, but the examples don't explain to me how to use it well enough. Usually I can read scipt and kind of figure it out. I was looking at the _IEFormElementSetValue for example. Seems like this would be my first choice. I need to identify the object I am trying to set a value to. I looked up the get object by name functions and again...the example script is lost on me.

Can anyone step me through with explanations what I would do. I apologize...I am just getting back into script writing and I have apparently lost some of my knowledge, plus I am a first time user of AutoIT.

Let me know if you need additional information from me....and Thanks for your assistance!

Link to comment
Share on other sites

for an simple example

$oIE = _IECreate("somewhere.com")
$oForm=_IEFormGetObjByName ($oIE, "Form1")
$name=_IEFormElementGetObjByName($oForm,"txtName")
_IEFormElementSetValue($name,"d4rk")

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

Thanks...I had seen these in the help before, but the examples don't explain to me how to use it well enough. Usually I can read scipt and kind of figure it out. I was looking at the _IEFormElementSetValue for example. Seems like this would be my first choice. I need to identify the object I am trying to set a value to. I looked up the get object by name functions and again...the example script is lost on me.

Can anyone step me through with explanations what I would do. I apologize...I am just getting back into script writing and I have apparently lost some of my knowledge, plus I am a first time user of AutoIT.

Let me know if you need additional information from me....and Thanks for your assistance!

So did you try executing any of the examples instead of just looking at them? Every one of them is a full stand-alone piece of code that demonstrates it's usage. If this really isn't enough for you to get an idea of how a function is used, I'll be interested in some specific feedback -- a lot of energy was expended to make them useful.

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

Link to comment
Share on other sites

for an simple example

$oIE = _IECreate("somewhere.com")
$oForm=_IEFormGetObjByName ($oIE, "Form1")
$name=_IEFormElementGetObjByName($oForm,"txtName")
_IEFormElementSetValue($name,"d4rk")

So did you try executing any of the examples instead of just looking at them? Every one of them is a full stand-alone piece of code that demonstrates it's usage. If this really isn't enough for you to get an idea of how a function is used, I'll be interested in some specific feedback -- a lot of energy was expended to make them useful.

Dale

I tried to insert this code, but I wasn't certain what changes I would have to make.

$oIE = _IECreate("somewhere.com") --this has to do with the website

$oForm=_IEFormGetObjByName ($oIE, "Form1") --not sure what this does

$name=_IEFormElementGetObjByName($oForm,"txtName") --not sure how this locates the object

_IEFormElementSetValue($name,"d4rk") --I am assuming this sends the text I want to the field I somehow located above

I changed the web address and inserted my vairable that captures the text from my input box in the 4th line instead of "d4rk"...but nothing happened. Again...I think I don't I understand what I am suppose to put in lines 2 and 3. Sorry for my ignorance with this. I created a fairly simple and effective code in IE6 that works in IE7 except for inserting captured data into a text field.

Thanks for your help so far, but it looks like I am still needing more.

Link to comment
Share on other sites

So you quoted my text, but appear to have ignored it. You realize of course that I was referring to the examples in the helpfile.

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

Link to comment
Share on other sites

I tried to insert this code, but I wasn't certain what changes I would have to make.

$oIE = _IECreate("somewhere.com") --this has to do with the website

$oForm=_IEFormGetObjByName ($oIE, "Form1") --not sure what this does

$name=_IEFormElementGetObjByName($oForm,"txtName") --not sure how this locates the object

_IEFormElementSetValue($name,"d4rk") --I am assuming this sends the text I want to the field I somehow located above

I changed the web address and inserted my vairable that captures the text from my input box in the 4th line instead of "d4rk"...but nothing happened. Again...I think I don't I understand what I am suppose to put in lines 2 and 3. Sorry for my ignorance with this. I created a fairly simple and effective code in IE6 that works in IE7 except for inserting captured data into a text field.

Thanks for your help so far, but it looks like I am still needing more.

$oIE = _IECreate("somewhere.com"); you've catched this

$oForm=_IEFormGetObjByName ($oIE, "Form1");Form which has the text box inside (look at this in the HTML code of page by View source)

$name=_IEFormElementGetObjByName($oForm,"txtName"); name of the text box , in this case, it's txtName

_IEFormElementSetValue($name,"d4rk"); set value for the text box = d4rk

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

So you quoted my text, but appear to have ignored it. You realize of course that I was referring to the examples in the helpfile.

Dale

I do realize where you said to look. The examples in the helpfile are the similar to what was provided here. There is not a detailed explanation per line to help.

; *******************************************************

; Example 1 - Open a browser with the form example, set the value of a text form element

; *******************************************************

;

#include <IE.au3>

$oIE = _IE_Example ("form")

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

$oText = _IEFormElementGetObjByName ($oForm, "textExample")

_IEFormElementSetValue ($oText, "Hey! This works!")

This is why I was looking for something similar to what d4rk provided. I am sorry if this is too remedial of a question for you. Some folks just need that little extra help to understand.

Link to comment
Share on other sites

$oIE = _IECreate("somewhere.com"); you've catched this

$oForm=_IEFormGetObjByName ($oIE, "Form1");Form which has the text box inside (look at this in the HTML code of page by View source)

$name=_IEFormElementGetObjByName($oForm,"txtName"); name of the text box , in this case, it's txtName

_IEFormElementSetValue($name,"d4rk"); set value for the text box = d4rk

I tried looking in the source code, but it has been a while since I looked for that type of info in HTML. This is what I came up with:

#include <IE.au3>

$oIE = _IECreate("www.dreamcmo.com/votetop3.php?fullname=Ronald West (Tripp)&bgcolor=991b1e&cmodid=CMO-FEA3DB869D51BCAB1782944635A751A7")

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

$name=_IEFormElementGetObjByName($oForm,"security_code")

_IEFormElementSetValue($name,$SecCode)

FYI...$SecCode is being gathered from an Input Box prior to this code.

This is the error I received:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Downloads\TrippScript2.au3"

C:\Program Files\AutoIt3\Include\IE.au3 (164) : ==> "While" statement has no matching "Wend" statement.:

Func _IECreate($s_Url = "about:blank", $f_tryAttach = 0, $f_visible = 1, $f_wait = 1, $f_takeFocus = 1)

????????????????????????????????????????????????????????????????????????????????????????????????????????

I don't have any open "While" statements. This error didn't occur until I added the above code.

Link to comment
Share on other sites

press Ctrl + F, type "Wend" then "While" i'm sure you would file 1 due to the error

[quote]Don't expect for a perfect life ... Expect a least troubles ones[/quote]Contact me : ass@kiss.toWhat I Have Done :Favorites Manager Mangage your favorite's folder, that's coolPC Waker For those who want to save stickersWebScipts Supporter For those who've just started with Web and WebScriptsTemporary Looker Simple but powerful to manage your Temporary folder, you know what you downloaded[UDF] _NumberFormat() Better performance on number display[UDF] _DirGet() What a folder contain [how many (hidden,normal,...) files], with one line of code[UDF] _IsPressEs() Just like _IsPress() but for a group of keys

Link to comment
Share on other sites

I do realize where you said to look. The examples in the helpfile are the similar to what was provided here. There is not a detailed explanation per line to help.

I see. So you only looked at the code, but you never tried running it. That is what I suspected. You don't know what you are missing.

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

Link to comment
Share on other sites

press Ctrl + F, type "Wend" then "While" i'm sure you would file 1 due to the error

I already checked...not sure why the script wouldn't have that error message until I added that 4 lines of code using _IE* functions though.

I have one While and one Wend.

UPDATE: I just copied the code into a new file in the editor and it isn't getting the error message for that anymore. I am getting these error messages though:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\!Taylor\AutoIt Scripts\TrippScriptIE7_ver2.au3"

--> IE.au3 Warning from function _IEFormGetObjByName, $_IEStatus_NoMatch

--> IE.au3 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidDataType

--> IE.au3 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType

This is the code that was pasted:

#include <Misc.au3>
#include <IE.au3>   
    
    
$oIE = _IECreate("www.dreamcmo.com/votetop3.php?fullname=Ronald West (Tripp)&bgcolor=991b1e&cmodid=CMO-FEA3DB869D51BCAB1782944635A751A7")
$SecCode = InputBox("Security Code", "Please enter the current Security Code and click OK (or Press ENTER)")
$oForm=_IEFormGetObjByName ($oIE, "dreamcmo")
$name=_IEFormElementGetObjByName($oForm,"security_code")
_IEFormElementSetValue($name,$SecCode)

Can you view the source code and see where I might be going wrong with the form and text name?

Edited by Dino24t
Link to comment
Share on other sites

I see. So you only looked at the code, but you never tried running it. That is what I suspected. You don't know what you are missing.

Dale

I did run the code...the only difference is that I didn't use this:

$oIE = _IE_Example ("form")

I got an error message when I ran the code.

Again, I am not certain exactly what that will do to determine how am suppose to use it. I read the helpfile and I don't know how this fits in.

I can copy and paste code and run it all day long, but if I don't understand it then I am just coding blind which seems like a waste of time.

Link to comment
Share on other sites

I did run the code...the only difference is that I didn't use this:

$oIE = _IE_Example ("form")

I got an error message when I ran the code.

Again, I am not certain exactly what that will do to determine how am suppose to use it. I read the helpfile and I don't know how this fits in.

I can copy and paste code and run it all day long, but if I don't understand it then I am just coding blind which seems like a waste of time.

So, you did run the example code, but you changed it and you got an error, so it isn't useful to you. Are you nuts? Before you complain that the documentation is not useful, at least once use it the way it was intended. Just run the example code the way it was written.

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

Link to comment
Share on other sites

So, you did run the example code, but you changed it and you got an error, so it isn't useful to you. Are you nuts? Before you complain that the documentation is not useful, at least once use it the way it was intended. Just run the example code the way it was written.

Dale

I ran the example code.

#include <IE.au3>
$oIE = _IE_Example ("form")
$oForm = _IEFormGetObjByName ($oIE, "ExampleForm")
$oText = _IEFormElementGetObjByName ($oForm, "textExample")
_IEFormElementSetValue ($oText, "Hey! This works!")

And yes that works very nicely. I understand the concept of the code...and have since d4rk explained a little. Here is the problem that is preventing me from adapting it to my needs.

VISIT:

www.dreamcmo.com/votetop3.php?fullname=Ronald West (Tripp)&bgcolor=991b1e&cmodid=CMO-FEA3DB869D51BCAB1782944635A751A7

The FORM doesn't reference a NAME for it. If I can't reference the FORM then the rest of the code doesn't work. Any thoughts on that?

Link to comment
Share on other sites

Please see the "Remarks" in the helpfile for _IEFormGetObjByName:

Remarks

If the desired form does not have a name or ID, _IEFormGetCollection to get a reference by index

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

Link to comment
Share on other sites

Please see the "Remarks" in the helpfile for _IEFormGetObjByName:

Dale

That helped. I must have missed that info while I was jumping around all of the _IE functions trying to figure it out. I had a few other obstacles to get through, but understanding what got me through the first obstacle helped me through the rest. I am not near a PC with IE7 on it, but my new streamlined code works very well with IE6. I will update you all when I get a chance to try it on IE7.

Thanks for hanging in there with me.

Link to comment
Share on other sites

--> IE.au3 Warning from function _IELoadWait, $_IEStatus_LoadWaitTimeout

Just noticed this after the script acted a little quirky.

What is the default time it will wait before this will happen? I think this is automatically called and there is some way to partially disable by increasing the initial timeout.

The script pauses for a while, but the IE window isn't even showing up on screen like it is trying to load in the meantime. Is the script keeping it from showing before it is fully loaded or something?

Not a big deal, just a quirk I want to fix if possible. This way my counter doesn't restart everytime I start the script up again.

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