ice1000 Posted December 22, 2007 Share Posted December 22, 2007 I want to retrieve each option value from a select tag on a web page and list them in one column in Excel. My code correctly retrieves the option value but it puts each value in the same cell instead of moving down one cell for each value. Anyone have any ideas on what I am doing wrong? $oExcelx = ObjGet("","Excel.Application");Get current instance of Excel $oIE = _IEAttach("Sheet Editor") $oExcelx.Activeworkbook.Activesheet.range("D1").Activate ;trying to get correct found account $oFoundAccount = _IEGetObjById ($oIE, "SelectAccounts") $o_Options = _IETagNameGetCollection($oFoundAccount, "option") For $o_Option in $o_Options $iCurrentRow = 1 $oExcelx.Activeworkbook.Activesheet.cells($iCurrentRow,4).value = $o_Option.text $iCurrentRow = $iCurrentRow + 1 Next Link to comment Share on other sites More sharing options...
martin Posted December 22, 2007 Share Posted December 22, 2007 $oExcelx = ObjGet("","Excel.Application");Get current instance of Excel $oIE = _IEAttach("Sheet Editor") $oExcelx.Activeworkbook.Activesheet.range("D1").Activate ;trying to get correct found account $oFoundAccount = _IEGetObjById ($oIE, "SelectAccounts") $o_Options = _IETagNameGetCollection($oFoundAccount, "option") For $o_Option in $o_Options $iCurrentRow = 1;<----------------move this to before the for/next loop############################# $oExcelx.Activeworkbook.Activesheet.cells($iCurrentRow,4).value = $o_Option.text $iCurrentRow = $iCurrentRow + 1 Next Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
ice1000 Posted December 22, 2007 Author Share Posted December 22, 2007 THAT was a simple programming error. I can't test because the code refuses to work. When executing, I get the following error: Variable must be of type "Object".: Excel is open and the ObjGet is apparently not getting the correct object. Why is the code all of the sudden bombing? Link to comment Share on other sites More sharing options...
ice1000 Posted December 22, 2007 Author Share Posted December 22, 2007 THAT was a simple programming error.I can't test because the code refuses to work.When executing, I get the following error: Variable must be of type "Object".:Excel is open and the ObjGet is apparently not getting the correct object.Why is the code all of the sudden bombing?Rebooting solved the problem. This has happened a few times.Is there a way to 'reset' AutoIt so I don't have to reboot? Link to comment Share on other sites More sharing options...
DaleHohm Posted December 23, 2007 Share Posted December 23, 2007 It is not AutoIt that needs to be "reset". More likely it is a foobar excel.exe running on your system. Exit Excel and then use task manager to kill excel.exe if it is still running. 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