APPLEEATER Posted August 28, 2008 Share Posted August 28, 2008 Hi, i need to make a script to go to a webpage and then check some info in a form, the only problem is that the form i'm trying to get information out of does not have a name or id E.g: <form method="POST" action=""> The element that i am trying to get information from has a name, how can i get the information from it, because the way i am doing it: $L_id1 = _IEFormGetObjByName($W_IE, "") $L_id2 = _IEFormGetObjByName($L_id1, "log") Is not working Thanks in advance Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 28, 2008 Share Posted August 28, 2008 Hi, i need to make a script to go to a webpage and then check some info in a form, the only problem is that the form i'm trying to get information out of does not have a name or id E.g: <form method="POST" action=""> The element that i am trying to get information from has a name, how can i get the information from it, because the way i am doing it: $L_id1 = _IEFormGetObjByName($W_IE, "") $L_id2 = _IEFormGetObjByName($L_id1, "log") Is not working Thanks in advance The forms can be addressed by their zero-based index number: ; Get first form $oForm1 = _IEFormGetCollection($oIE, 0) ; Get second form $oForm2 = _IEFormGetCollection($oIE, 1) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted August 28, 2008 Moderators Share Posted August 28, 2008 Really isn't enough information to even attempt to help you, well others can attempt, but they'll only be guessing.You should download: Debugbar when working with _IE* functions.Guess:_IEFormGetCollection and work through those trying to get the object you want. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
APPLEEATER Posted August 28, 2008 Author Share Posted August 28, 2008 Really isn't enough information to even attempt to help you, well others can attempt, but they'll only be guessing.You should download: Debugbar when working with _IE* functions.Guess:_IEFormGetCollection and work through those trying to get the object you want.Ok,but is the number the equivalent of a tab index?or is it actually the form index? Link to comment Share on other sites More sharing options...
Szhlopp Posted August 28, 2008 Share Posted August 28, 2008 Ok, but is the number the equivalent of a tab index? or is it actually the form index? I repeat myself alot with this...Maybe it's time for me to make a tutorial on Inet functions? expandcollapse popup#include <IE.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> ; $webAdd = "https://www.###.com" $gui1 = GUICreate("Form1", 471, 214, 193, 125) $List1 = GUICtrlCreateList("", 0, 0, 185, 188, $WS_BORDER + $WS_VSCROLL + $WS_TABSTOP + $LBS_NOTIFY) $webaddr = GUICtrlCreateInput($webAdd, 197, 10, 250, 21) $field = GUICtrlCreateInput("", 198, 44, 250, 21) $Button1 = GUICtrlCreateButton("Set field", 256, 86, 108, 38, 0) GUISetState(@SW_SHOW) $oIE = _IECreate ($webAdd, 0, 0) FindUserName($oIE) _IEQuit($oIE) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $button1 $oIE = _IECreate ($webAdd) ;FindUserName($oIE) $selitem = _GUICtrlListBox_GetCurSel($list1) $seltext = _GUICtrlListBox_GetText($list1, $selitem) $formNum = Int(StringLeft($seltext, 2)) $oForm = _IEFormGetCollection ($oIE, $formNum) $IEelements = _IEFormElementGetCollection ($oForm, $selitem) _IEFormElementSetValue($IEelements, GUICtrlRead($field)) EndSwitch WEnd Func FindUserName($oIE) $oForms = _IEFormGetCollection ($oIE) $iNumForms = @extended For $A = 0 to $iNumForms - 1 $oForm = _IEFormGetCollection ($oIE, $A) $ocollection = _IEFormElementGetCollection ($oForm) $Elecount = @extended Global $IEelements[Int($Elecount)] For $I = 0 to $Elecount - 1 $IEelements[$I] = _IEFormElementGetCollection ($oForm, $I) _GUICtrlListBox_AddString($list1, $A & " " & $I + 1 & ") " & $IEelements[$I].name) Next Next EndFunc "0 1) Name" First value is the form ID Second is the element ID RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 28, 2008 Share Posted August 28, 2008 Ok,but is the number the equivalent of a tab index?or is it actually the form index?The _IEFormGetCollection() examples I showed used the index of the form in the browser object ($oIE). If you mean tabs in IE7, then each tab has its own reference. Use _IEAttach() to get the object reference to the one you want, then you look in that for the form. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
APPLEEATER Posted August 29, 2008 Author Share Posted August 29, 2008 The _IEFormGetCollection() examples I showed used the index of the form in the browser object ($oIE). If you mean tabs in IE7, then each tab has its own reference. Use _IEAttach() to get the object reference to the one you want, then you look in that for the form. Well,now i i've fixed this...but i've got a compleatly different problem...My script isn't exactly something i want to show,and i make the same thing but as an example it works,so i'll have to just debug on my own... 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