Masternoop Posted May 20, 2009 Share Posted May 20, 2009 Hi there, I am new to this forum and to IT scripting. I got a script that fills a IE form automatically. I use include ie.au and include Excel.au and the following code ;Add form name new page to Var $oForm = _IEFormGetObjByName ($oIE, "mainform") ;~;Select Personal data SEL1N1__0 $sCellValue = _ExcelReadCell($oExcel, $row, 4) $oSelect = _IEFormElementGetObjByName ($oForm, "SEL1N1__0") _IEFormElementSetValue ($oSelect, $sCellValue) This actually works great, the problem is that sometimes an Excel cel is not filled because that particular item in the form is already filled. With this code it actually sends the blank cells from Excel that will then overwrite anything typed in the IE form. Is there a code that skips blank Excel cells? Or is there a trick to make it skip blank cells? I got lots of these lines in my code, so if there is a way to set it globally in stead of at every line that would be even better. Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 20, 2009 Share Posted May 20, 2009 Hi there, I am new to this forum and to IT scripting. I got a script that fills a IE form automatically. I use include ie.au and include Excel.au and the following code ;Add form name new page to Var $oForm = _IEFormGetObjByName ($oIE, "mainform") ;~;Select Personal data SEL1N1__0 $sCellValue = _ExcelReadCell($oExcel, $row, 4) $oSelect = _IEFormElementGetObjByName ($oForm, "SEL1N1__0") _IEFormElementSetValue ($oSelect, $sCellValue) This actually works great, the problem is that sometimes an Excel cel is not filled because that particular item in the form is already filled. With this code it actually sends the blank cells from Excel that will then overwrite anything typed in the IE form. Is there a code that skips blank Excel cells? Or is there a trick to make it skip blank cells? I got lots of these lines in my code, so if there is a way to set it globally in stead of at every line that would be even better. Like this: $sCellValue = _ExcelReadCell($oExcel, $row, 4) If StringStripWS($sCellValue, 8) <> "" Then $oSelect = _IEFormElementGetObjByName($oForm, "SEL1N1__0") _IEFormElementSetValue($oSelect, $sCellValue) EndIf 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...
Masternoop Posted May 22, 2009 Author Share Posted May 22, 2009 Thank you, that works great! As i mentioned in my post i have lots of lines with this code, so this option adds 2 extra lines per Excel cell i use (use about 80 cells), do you know a way of making this code a bit more managable? Link to comment Share on other sites More sharing options...
Masternoop Posted May 22, 2009 Author Share Posted May 22, 2009 I got some help from a friend of mine in making this code smaller. He managed to create a function that perfoms the steps in the code, this is the code: ; Function for filling IE from Excel Func _FillField($oExcel, $oForm, $row, $iColumn, $sVeld) Local $sCellValue, $oSelect $sCellValue = _ExcelReadCell($oExcel, $row, $iColumn) if $sCellvalue <> "" Then $oSelect = _IEFormElementGetObjByName ($oForm, $sVeld) _IEFormElementSetValue ($oSelect, $sCellValue) Else EndIf EndFunc ;==>_FillField Then we use the following code to autofill IE from Excel _FillField($oExcel, $oForm, $row, 1, "NAMEFIELD" ) This code continues on various rows and thier corresponding fields in the IE forms. He is obviously a way better coder in IT then me . 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