Jump to content
Sign in to follow this  
JamieO

Need help with frames and IE.au3

Recommended Posts

JamieO

Hi guys, this is my first post. I am new to autoit and am looking at getting help with filling out forms that are frames.

Most of my background in programming is in computational physics, so i have very little experience in application development and even less in scripting and web development.

Basically i am looking at how one would use the IE.au3 functions to login to a site like this that uses frames: http://www.thegreek.com/sports/home.asp.

I understand and have used the _IEFormGetCollection and _IEFormElementGetObjByName functions to create an auto-login program for another site, but i dont really get how to use the _IEFrameGetCollection, and _IEFrameGetObjByName. I dont know how to get the name of an object in a frame. Are there tools for such things?

Any help would be greatly appreciated.

Edited by JamieO

Share this post


Link to post
Share on other sites
Josbe

Hi guys, this is my first post. I am new to autoit and am looking at getting help with filling out forms that are frames.

Most of my background in programming is in computational physics, so i have very little experience in application development and even less in scripting and web development.

Basically i am looking at how one would use the IE.au3 functions to login to a site like this that uses frames: http://www.thegreek.com/sports/home.asp.

I understand and have used the _IEFormGetCollection and _IEFormElementGetObjByName functions to create an auto-login program for another site, but i dont really get how to use the _IEFrameGetCollection, and _IEFrameGetObjByName. I dont know how to get the name of an object in a frame. Are there tools for such things?

Any help would be greatly appreciated.

I think this tool maded by Valuater, could help you: IE builder.

Share this post


Link to post
Share on other sites
DaleHohm

IE Builder would help. So would this modification to the example for _IEFrameGetCollection to get frame names:

#include <IE.au3>
$oIE = _IE_Example ("frameset")
$oFrames = _IEFrameGetCollection ($oIE)
$iNumFrames = @extended
For $i = 0 to ($iNumFrames - 1)
    $oFrame = _IEFrameGetCollection ($oIE, $i)
    MsgBox(0, "Frame Info", $oFrame.name)
Next

Also, strongly recomment the free DebugBar in my sig to get you going faster.

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
JamieO

Thanks guys, that DebugBar is an awesome tool, i just installed it and have started playing around with it. It will definetly help me figure this out.

Share this post


Link to post
Share on other sites
JamieO

so i got it to work using the basic form of an autoit login i found on here somewhere, i had a few questions about the code though if anyone can anwser.

CODE

#include <IE.au3>

$TGID="guest"

$TGPass="guest"

$oTimeout=5000

TGlogin ($TGID, $TGPass, $oTimeout)

Func TGLogin ($TGID, $TGPass, $oTimeout)

Global $oIE, $oFrame, $oName, $opass, $otimer, $oForm

_IELoadWaitTimeout($oTimeOut) ;sets timeout in milliseconds (5000=5seconds) why is timeout necessary?

_IEErrorHandlerRegister() ; registers the default IE.au3 com error handler what does this mean?

$oIE = _IECreate("http://www.thegreek.com/sports/home.asp")

$oFrame = _IEFrameGetObjByName ($oIE, "main")

$oForm = _IEFormGetCollection($oFrame, 0)

$oName = _IEFormElementGetObjByName($oForm, "username")

$oPass = _IEFormelementgetobjbyname($oForm, "password")

_IEFormElementSetValue($oName, $TGID)

_IEFormElementSetValue($opass, $TGPass)

_IEFormSubmit ($oForm)

$Timer = TimerInit()

Do

Sleep(1)

Until _IEPropertyGet($oIE, "locationurl") = "http://www.thegreek.com/sports/home.asp" Or TimerDiff($Timer) > $oTimeOut ; what does this do???

_IEErrorHandlerDeRegister()

EndFunc

Share this post


Link to post
Share on other sites
DaleHohm

What you have is likely more complicated taht it needs to be. This is all you should need:

#include <IE.au3>
$oIE = _IECreate("http://www.thegreek.com/sports/home.asp") 
$oFrame = _IEFrameGetObjByName ($oIE, "main")
$oForm = _IEFormGetCollection($oFrame, 0)
$oName = _IEFormElementGetObjByName($oForm, "username")
$oPass = _IEFormelementgetobjbyname($oForm, "password")
_IEFormElementSetValue($oName, $TGID)
_IEFormElementSetValue($opass, $TGPass)
_IEFormSubmit ($oForm)oÝ÷ Øò¢èZ½ëk¢æå{­Ø^ Ah®d®nh­±ç­êÞªä{az¥¥ø¥yú+¶­~éܶ*'­êeiÇ¢·­«­¢+Ù}%½ÉµMÕµ¥Ð ÀÌØí½½É´°À¤)}%1½]¥Ð ÀÌØí½Éµ¤

or if the frame disappears as a result of the submitted form, replace the last $oFrame with $oIE

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.