hg2052 Posted May 26, 2013 Share Posted May 26, 2013 Hi! I have the following code to retrieve table content of a web page and write it to Excel 2007.It works fine with IE9, but nothing is written to he spreadsheet when I try to use IE7. Can someone give a solution (except giving up IE7)? Thanx. If StringFormat($line)"" Then $adress="http://www.xxx.yyy/vvvvvv/" & StringFormat($line) Local $oIE=_IECreate("http://www.xxx.yyy") Sleep(2000) _IENavigate($oIE,$adress,1) _IELoadWait($oIE) Sleep(10000) $body = _IEBodyReadHTML($oIE) Local $sHTML = _IEBodyReadHTML($oIE) If StringInStr($body,'',2) 0 Then FileWriteLine("Found.txt",$line) $j=$j+3 $vgt=VarGetType('') $oTable = _IETableGetCollection($oIE) Local $iNumTables = @extended $oTable = _IETableGetCollection ($oIE, $iNumTables-1) $aTableData = _IETableWriteToArray ($oTable) If $j>2 Then _ArrayDelete($aTableData,0) EndIf _ExcelWriteSheetFromArray($oExcel, $aTableData, $j, 1, 0, 0) Sleep(1000) _IEQuit($oIE) If @error Then ExitLoop EndIf _IEQuit($oIE) EndIf _ExcelBookSaveAs($oExcel, 'DestFile.xls',0,1) _ExcelBookClose($oExcel, 0, 0) Link to comment Share on other sites More sharing options...
water Posted May 26, 2013 Share Posted May 26, 2013 If you run your script from SciTE do you get any error messages in the output pane? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
hg2052 Posted May 26, 2013 Author Share Posted May 26, 2013 No message. Link to comment Share on other sites More sharing options...
water Posted May 26, 2013 Share Posted May 26, 2013 Then please add line _ArrayDisplay($aTableData) after the following line to check if the table was populated by IE. $aTableData = _IETableWriteToArray ($oTable) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
hg2052 Posted May 26, 2013 Author Share Posted May 26, 2013 Nothing is displayed. In fact, I've already checked this. Link to comment Share on other sites More sharing options...
water Posted May 26, 2013 Share Posted May 26, 2013 Then line $aTableData = _IETableWriteToArray($oTable) doesn't create the table. What's the value of @error after the above line? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
hg2052 Posted May 26, 2013 Author Share Posted May 26, 2013 No error message is displayed (remember,it works flawlessly with IE9; the bug appears only with IE7). Link to comment Share on other sites More sharing options...
water Posted May 26, 2013 Share Posted May 26, 2013 I was not asking for an error message but for the value of @error. That's a big difference! My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
hg2052 Posted May 26, 2013 Author Share Posted May 26, 2013 I meant:there is no @error. Simply, the program goes on, without writing anything to Excel. Link to comment Share on other sites More sharing options...
water Posted May 26, 2013 Share Posted May 26, 2013 There is always @error because it is a macro created by AutoIt. If $aTableData is not an array then there must be an error somewhere in your script. You are sure the posted code is the code you run? This statement really looks suspicious: If StringFormat($line)"" Then My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
hg2052 Posted May 26, 2013 Author Share Posted May 26, 2013 You're suspicious, but the code executes with on a computer with IE9, but not with IE7. There is only one detail I didn't mention : IE7 displays, at the left lower corner,"Done, but with errors on page". Maybe one of these errors is responsible for what you consider looking suspicious. But I don't know which are IE7's errors. Link to comment Share on other sites More sharing options...
water Posted May 26, 2013 Share Posted May 26, 2013 The code you posted in post#1 can't be executed because you get a syntax error: >"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /prod /AU3Check /in "C:\Temp\Test.au3" +>20:26:40 Starting AutoIt3Wrapper v.2.1.2.9 Environment(Language:0407 Keyboard:00000407 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64) >Running AU3Check (1.54.22.0) from:C:\Program Files (x86)\AutoIt3 C:\Temp\Test.au3(2,25) : ERROR: syntax error If StringFormat($line)"" ~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Temp\Test.au3 - 1 error(s), 0 warning(s) !>20:26:40 AU3Check ended. Press F4 to jump to next error.rc:2 >Exit code: 0 Time: 0.879 Which code do you execute? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
hg2052 Posted May 26, 2013 Author Share Posted May 26, 2013 $line has been declared somewhere else in the program (which you should have guessed, I guess), so that's you get the error: Local $line = FileReadLine($file,Number($i)) I don't understand you: are you trying to help, or to find errors to please yourself? Link to comment Share on other sites More sharing options...
water Posted May 26, 2013 Share Posted May 26, 2013 Please again have a look at the error messages above! There are two double quotes (in bold and red below) in your original post and the error message I posted that give you a syntax error. This means that your code is unable to run! If StringFormat($line)"" My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 26, 2013 Moderators Share Posted May 26, 2013 hg2052, which you should have guessed, I guess If you want help the best way is to post code that we can run - why should we be expected to guess at what variables are declared or not? I don't understand you: are you trying to help, or to find errors to please yourself? In my opinion, water was being remarkably patient. i use the past tense advisedly - because if you were to speak to me like that that would be the end of any help you received. Might I suggest losing the attitude? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
hg2052 Posted May 26, 2013 Author Share Posted May 26, 2013 Water, Here you're right;but it's only a copying error, because in the program it is If StringFormat($line)<>"" Then M23, you're free in your suggestions.But I guess everybody would better enjoy freedom in Autoit than... Good night! Link to comment Share on other sites More sharing options...
BrewManNH Posted May 26, 2013 Share Posted May 26, 2013 StringFormat doesn't work like that, it needs at least one variable after the format string, your code line has neither. There's no format string, and there's no variable. That command could be written like "If $line <> "" then" and achieve the same result, the StringFormat function isn't doing anything. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
hg2052 Posted May 26, 2013 Author Share Posted May 26, 2013 Isn't $line that variable? Otherwise:I found remarks about IE7 an Autoit at: "" "http://www.autoitscript.fr/forum/viewtopic.php?f=3&t=2725&start=0" "" I intend to test the suggestions concerning 1)turn security to the lowest setting and uncheck "ENABLE PROTECTION MODE" 2)Use #RequireAdmin in my script Link to comment Share on other sites More sharing options...
BrewManNH Posted May 26, 2013 Share Posted May 26, 2013 Isn't $line that variable? Yes, you're right it's a variable. But as it seems you missed the important point I'll repeat it, you're using StringFormat in a pointless way. You don't need it in your script, because it doesn't affect the outcome of using it or not using it. So why bother using a function that you're using wrong and doesn't need to be there? If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
hg2052 Posted May 27, 2013 Author Share Posted May 27, 2013 Thank you, Ill try this AGAIN, but I remember I started do without StringFormat an d it didn't work. I think also about using thr table's name "Block 5" or4 or 6 or...etc instead of a table identifier. However, I exprct most from using what had been suggested in the links I mentioned. 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