JamieO Posted October 8, 2007 Share Posted October 8, 2007 (edited) 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 October 8, 2007 by JamieO Link to comment Share on other sites More sharing options...
Josbe Posted October 8, 2007 Share Posted October 8, 2007 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. AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta Link to comment Share on other sites More sharing options...
DaleHohm Posted October 8, 2007 Share Posted October 8, 2007 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 Link to comment Share on other sites More sharing options...
JamieO Posted October 8, 2007 Author Share Posted October 8, 2007 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. Link to comment Share on other sites More sharing options...
JamieO Posted October 9, 2007 Author Share Posted October 9, 2007 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 Link to comment Share on other sites More sharing options...
DaleHohm Posted October 9, 2007 Share Posted October 9, 2007 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now