Jump to content

Newbie confused with IE.au3


Recommended Posts

Hello all.

I'm a beginer in the world of AutoIt and I have been using the IE.au3 UDF but I find it little confusing when working with forms...

I'll try to explain myself the best I can.

For example in this lines from a AutoIT Snippets script:

#include <IE.au3>
$oIE = _IECreate("http://mail.google.com")

; get pointers to the login form and username and password fields
$oform = _IEFormGetObjByName($oIE, "gaia_loginform")
$ologin = _IEFormElementGetObjByName($oform, "Email")
$opassword = _IEFormElementGetObjByName($oform, "Passwd")

How do we now that the first form named there was "gaia_loginform", ok ok I found that out later using MODIV2...but for example in other websites like mail.yahoo.com you cannot see what form to use in that first line $oform = _IEFormGetObjByName($oIE, "????") I had to keep reading and foun another script example written by DaleHohm:

#include <IE.au3>
$oIE = _IECreate ("http://www.autoitscript.com")
$oForms = _IEFormGetCollection ($oIE)
$iNumForms = @extended
MsgBox(0, "Forms Info", "There are " & $iNumForms & " forms on this page")
For $i = 0 to $iNumForms - 1
    $oForm = _IEFormGetCollection ($oIE, $i)
    MsgBox(0, "Form Info", $oForm.name)
Next
oÝ÷ Ø    Ýiû^®»§)තú.Ú.·Zµú+v¦zÚ.±è§¶­~*ì¶X§y»­j¢ØZ¶g­g¢Ö¥Á¬¬ÂäÂ+a¢Ø^¯²+^±©Ý¶§!ø§vl¬zWÚ¨§rߺǢxhÂÚ zÛaz¸ ÙÚãhÀÞiÖ¢ën²)à Ah®a´*-èkçm«ZÖ¥²èºwm+,r¸©µ«­¢+ب¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨(ìáµÁ±Ä´ÐÉɹѼÍÁ¥¥½É´äÀµÍ¥¹à°(쥸ѡ¥ÌÍÑ¡¥ÉÍнɴ½¸Ñ¡Á(쨨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨(ì(¥¹±Õ±Ðí%¹ÔÌÐì(ÀÌØí½%ô}%
ÉÑ ÅÕ½Ðí¡ÑÑÀè¼½ÝÝܹ½½±¹½´ÅÕ½Ðì¤(ÀÌØí½½É´ô}%½ÉµÑ
½±±Ñ¥½¸ ÀÌØí½%°À¤(ÀÌØí½EÕÉäô}%½Éµ±µ¹ÑÑ
½±±Ñ¥½¸ ÀÌØí½½É´°Ä¤)}%½Éµ±µ¹ÑMÑY±Õ ÀÌØí½EÕÉä°ÅÕ½ÐíÕѽ%Ð%¹ÔÌÅÕ½Ðì¤)}%½ÉµMÕµ¥Ð ÀÌØí½½É´¤

Very good one, but, what if the web Im using that script has many forms...How do I know what index number is the corresponding to the form i want to work with?

I'm not asking for any specific script help, just trying to learn how to always know the right names, or in some cases the right index number of the forms..

Do I need very good HTML knowledge for this?

I hope you can understand my post, it is kinda hard for me to explain all the ideas in a foreing language :)

Thank you very much in advance.

Link to comment
Share on other sites

  • Moderators

I can tell you have done some searching on your own, that is more than most do before they start asking for help. You seemed to explain yourself very well for English not being your primary language.

The most valuable tool I've found is the Web Developer Extension for Firefox. It picks up where MODIV2 leaves off. You may also want to take a look at IE Builder which is a tool to help build scripts for use with IE.au3.

Link to comment
Share on other sites

Thank you big_daddy for taking the time to reply.

I'll check the Web Developer Extension, IE Builder I use it too.

My biggest problem is with the hidden forms, those that you can see are very easy to find the name or ID, but like the example I gave above:

#include <IE.au3>
$oIE = _IECreate("http://mail.yahoo.com")

; get pointers to the login form and username and password fields
$oform = _IEFormGetObjByName($oIE, "login_form")
$ologin = _IEFormElementGetObjByName($oform, "email")
$opassword = _IEFormElementGetObjByName($oform, "passwd")

The Login and Password forms are easy to find and check the properties, but in that case the form "login_form" that seems to contain the others was the really hard to get the name or at least know that that was the correct one to be able to work with email and passwd forms.

Anyway, I will keep reading, for some reason this is being very tricky for me to learn.

Thanks again.

(wow, posts here goes really fast, I had to go page 3 to find mine and it is from last night :))

Link to comment
Share on other sites

Thank you big_daddy for taking the time to reply.

I'll check the Web Developer Extension, IE Builder I use it too.

My biggest problem is with the hidden forms, those that you can see are very easy to find the name or ID, but like the example I gave above:

#include <IE.au3>
$oIE = _IECreate("http://mail.yahoo.com")

; get pointers to the login form and username and password fields
$oform = _IEFormGetObjByName($oIE, "login_form")
$ologin = _IEFormElementGetObjByName($oform, "email")
$opassword = _IEFormElementGetObjByName($oform, "passwd")oÝ÷ Ù8^."©Ý=«,ÂÝ~汪Þy«2¶âÖ§uÈ^rKazè¥êíëºØ§¶­q«¶¢¹ªºe¢§~æªê-¶­±ç¦²Ú¢{Z{azaz»0jËaz·¡j·m¢­¶§jg¨­«ey«-z0¶­¶­Á«-ç(®·¶Þ¶Þi¹^¶(®L"¶¦j)ZÚZ²Ì~æ°    òÁ¬Â)eç©­æx¢»(êÞjÊ'¶¬ÆÞx/z¼­®'$Éú+ëhæ«8ZK¨§Â)¢ËlêÞ¬­æ¥'Ú²Ò!iÛhZíí¡ø§vh§y©Ýج~º&«-(!´?êº^bjv¥²h²v( x"Ú-êZë-®ç-º·°Ølr¸©µ.q©æ¡ØÊÞ¡ü¨º·±jjezÇë¢f¢÷­¡ìZ)Þ¶LÂâæú+Ú,yì!Èh쨻§´Z+{¦¦WºÚ"µÍÚ[ÛYH ÒQK]LÉÝÂÌÍÛÒQHHÒQPÜX]H
    ][ÝÚËÝÝÝË]]Ú]ØÜÛÛI][ÝÊBÌÍÛÑÜÈHÒQQÜQÙ]ÛÛXÝ[Û
    ÌÍÛÒQJBÌÍÚS[QÜÈH^[YÛÛÛÛUÜ]J   ][ÝÕHH    ][ÝÈ  [È ÌÍÚS[QÜÈ   [È ][ÝÈÜÈÛÈYÙI][ÝÈ    [ÈÔ   [ÈÔBÜ    ÌÍÚHHÈ  ÌÍÚS[QÜÈHB ÌÍÛÑÜHHÒQQÜQÙ]ÛÛXÝ[Û
    ÌÍÛÒQK  ÌÍÚJBÛÛÛÛUÜ]J   ][ÝÔÛÝÙHÜÜH  ][ÝÈ  [È ÌÍÚH [ÈÔ   [È ][ÝÏOOOOOOOOOI][ÝÈ  [ÈÔ   [È ÌÍÛÑÜKÝ]S [ÈÔ   [È ][ÝÏOOOOOOOOOI][ÝÈ  [ÈÔ   [ÈÔB^

Perhaps this will give you some ideas.

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

  • Moderators

The Login and Password forms are easy to find and check the properties, but in that case the form "login_form" that seems to contain the others was the really hard to get the name or at least know that that was the correct one to be able to work with email and passwd forms.

I was able to find this very easily with the Web Developer Toolbar by pressing Ctrl+Shift+F (Information --> Display Element Information).
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...