Sign in to follow this  
Followers 0
iverson_est

_ieformgetobjbyname Help Please

14 posts in this topic

ok i want to use _IEFormGetObjByName command. I looked at Dales topic and there was this example:

#include <IE.au3>

$oIE = _IECreate()
_IENavigate($oIE, "http://www.autoitscript.com/forum/index.php?act=Search&f=")

$oFrom = _IEFormGetObjByName($oIE, "sForm")
$oRelevant = _IEFormElementGetObjByName($oFrom, "sortby", 0)
$oRecent = _IEFormElementGetObjByName($oFrom, "sortby", 1)

For $i = 1 to 5
    $oRelevant.checked = True
    Sleep(1000)
    $oRecent.checked = True
    Sleep(1000)
Next

well, in the site where i want it to use i figured the "sortby"s out. But strangely, the form has no name what so ever. So i don't know what to put to replace The "sForm" in this example. Can i even use this command?

And i looked that _IEFormElementGetObjByIndex(), but i don't know how to use it :mellow::)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

http://www.autoitscript.com/forum/index.ph...358entry91358

there are some examples with ie.au3. this code from it.

#include <IE.au3>

$sImgDir = "c:\foo\"; Please make certain this folder already exists (silent failure if not)
$sWebPage = "http://www.autoitscript.com/forum/index.php?"; webpage with images

$oIE = _IECreate()
_IENavigate($oIE, $sWebPage)
$oIMGs = _IETagNameGetCollection($oIE.document, "img")

; Loop through all IMG tags and save file to local directory using INetGet
For $oIMG in $oIMGs
    $sImgUrl = $oIMG.src
    $sImgFileName = $oIMG.nameProp
    INetGet($sImgUrl,  $sImgDir & $sImgFileName)
Next
Edited by Libre

I love this Game :p----------------------Freeware Multilange support or Translate your scripts----------------------aNyBoDy KnOwS WhY A LiGhT iN My KeYbOaRd iS aLlWaIs BlInKiNg !?Who is "General Failure" and what is he doing in my hard disk !!!!!?

Share this post


Link to post
Share on other sites

i already looked there, as i said in my previous post. And my prob is that i want to put autoit check the radio buttons in IE, i tried to figure it out with the example what was on that page, i figured out the "sortby" things, but the page where i want to use it does not have form name what is needed:

$oFrom = _IEFormGetObjByName($oIE, "it is needed here") and i dnno what to put there. And i am asking can i do it with _IEFormGetObjByName.

Share this post


Link to post
Share on other sites

do u have the source the website you are looking at ? or the link to it, when it says get obj by name there will be text in the source that says name = WHATEVERTHENAMEIS and thats what goes there but u have to find the right radio button and the right form name, so

Share this post


Link to post
Share on other sites

do u have the source the website you are looking at ? or the link to it, when it says get obj by name there will be text in the source that says name = WHATEVERTHENAMEIS and thats what goes there but u have to find the right radio button and the right form name, so

well excuse me, i am not that dumb. Like ofc i have the source, i found the places where the radios are written and stuff. But there is just no name...

<FORM ACTION=show.php METHOD=POST>

Share this post


Link to post
Share on other sites

well excuse me, i am not that dumb. Like ofc i have the source, i found the places where the radios are written and stuff. But there is just no name...

<FORM ACTION=show.php METHOD=POST>

The 2nd parameter in _IEFormElementGetObjByIndex() is a number representing where the form is sequentially in the collection of forms on the page (in source order). The first form is index 0, the second is 1 etc. There are scripts in reply 37 of the IE.au3 thread (also available in Valuator's IE builder script) that will help you get the 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

Share this post


Link to post
Share on other sites

well the thing is that i want the program to start clicking the radios in rate.ee/show.php .

when i run the script what looks like this:

#include <IE.au3>

$o_IE = _IECreate ()

_IENavigate($o_IE, "http://www.rate.ee/show.php")

$oForm = _IEFormGetObjByIndex($o_IE, "2")

$oViis = _IEFormElementGetObjByName($oForm, "rating", 5)

but i get an error dealing with ie.au3.

Line 859

Error : Variable must be of type "Object".

Yes, i have newest beta and Scite. And i run it with beta also.

Share this post


Link to post
Share on other sites

$oForm = _IEFormGetObjByIndex($o_IE, "2")

For one thing, use 2 instead of "2" in this line... it is a number, not a string.

Also check your return valves to see the source of your trouble.

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

wow, this time i ran it it gave me no errors, yey :) Now i must implement thic click part...

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

now my code is like this:

$o_IE = _IECreate ()

_IENavigate($o_IE, "http://www.rate.ee/show.php")

While 1

$oForm = _IEFormGetObjByIndex($o_IE, 2)

$oViis = _IEFormElementGetObjByName($oForm, "rating", 5)

$oViis.checked = True

WEnd

but it just goes to this page and does nothing. I am quite not sure about about getobjbyindex thing, i mean, i should go to the page, open it source code and count which <Form action etc etc> it is and put the number to there? or what :)

lol thanks for help :">

edit:

ah and 1 more thing, it seems that i am dealing with a "group", but strange is that they all have the same name but different valuse, but dalehohm said that grups are which have the same name but grups don't have values.

Edited by iverson_est

Share this post


Link to post
Share on other sites

now my code is like this:

$o_IE = _IECreate ()

_IENavigate($o_IE, "http://www.rate.ee/show.php")

While 1

$oForm = _IEFormGetObjByIndex($o_IE, 2)

$oViis = _IEFormElementGetObjByName($oForm, "rating", 5)

$oViis.checked = True

WEnd

but it just goes to this page and does nothing. I am quite not sure about about getobjbyindex thing, i mean, i should go to the page, open it source code and count which <Form action etc etc> it is and put the number to there? or what :)

lol thanks for help :">

edit:

ah and 1 more thing, it seems that i am dealing with a "group", but strange is that they all have the same name but different valuse, but dalehohm said that grups are which have the same name but grups don't have values.

Your IE code looks valid, however there is a problem...

Do you understand what a While...WEnd loop does? While checks a condition and as long as the condition is true it will execute the code up to the WEnd over and over again. Since you are testing the condition "1", which evaluates to "True" now and forever you will never get out of the While loop and your script will appear to hang. I don't think you need the While WEnd at all.

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

well basically i got it working. Yes i know what the loop does. Problem was that i thought it would click on the radio not only check it :) How can i get it clicking? Tried(sorry for my english, is it it tried or tryed?) enter, it wouldn't work.

Tha page has such system like when you click on a radio, new almost same page comes up only with different pic and so on, i thought loop would be good there. But since it is not clicking i cant apply loop there.

So now it checks it yay! but any ideas on the clicking part?

Share this post


Link to post
Share on other sites

$oViis.click


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

thanks a bunch m8 :)

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