oemript Posted October 27, 2018 Share Posted October 27, 2018 (edited) Referring to following coding, I would like to know on how to append data as shown below using _FileWriteFromArray 1) Initial file by _FileWriteFromArray($sFilePath, $atradeLog1, 1) 2) How to append data into existing file using FileWriteFromArray? Does anyone have any suggestions? Thanks in advance for any suggestions Ref : https://www.autoitscript.com/autoit3/docs/libfunctions/_FileWriteFromArray.htm #include <Array.au3> #include <IE.au3> #include <File.au3> Global $oIE = _IECreate("http://www.aastocks.com/en/stocks/analysis/transaction.aspx?symbol=00005", 1) _IELoadWait($oIE, 5000) Global $otradeLog = _IEGetObjByName($oIE, "charttype") _IEAction($otradeLog, "click") Global $otradeLog1 = _IEGetObjById($oIE, "tradeLog1") Global $atradeLog1 = _IETableWriteToArray($otradeLog1, True) Global $otradeLog2 = _IEGetObjById($oIE, "tradeLog2") Global $atradeLog2 = _IETableWriteToArray($otradeLog2, True) ; Create a file in the users %TEMP% directory. Local $sFilePath = "D:\stocks.txt" ; Write array to a file by passing the file name. _FileWriteFromArray($sFilePath, $atradeLog1, 1) _FileWriteFromArray($sFilePath, $atradeLog2, 1) ; Display the file. ShellExecute($sFilePath) Edited October 27, 2018 by oemript Link to comment Share on other sites More sharing options...
water Posted October 27, 2018 Share Posted October 27, 2018 Dog ate your help file? It's all there FrancescoDiMuro 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
oemript Posted October 27, 2018 Author Share Posted October 27, 2018 There is no description about append data using following function. Do you have any suggestions? Thank you very much for any suggestions (^v^) _FileWriteFromArray Writes an array to a specified file #include <File.au3> _FileWriteFromArray ( $sFilePath, Const ByRef $aArray [, $iBase = Default [, $iUBound = Default [, $sDelimiter = "|"]]] ) Parameters $sFilePath Path of the file to write to, or a file handle returned by FileOpen(). $aArray The array to be written to the specified file. $iBase [optional] Start array index to read, normally set to 0 or 1. Default is 0. $iUbound [optional] Set to the last record you want to write to the File. Default is the whole array. $sDelimiter [optional] Delimiter character(s) for 2-dimension arrays. Default is "|". Return Value Success: 1. Failure: 0 and sets the @error flag to non-zero. @error: 1 - Error opening specified file 2 - $aArray is not an array 3 - Error writing to file 4 - $aArray is not a 1D or 2D array 5 - Start index is greater than the $iUbound parameter Link to comment Share on other sites More sharing options...
water Posted October 27, 2018 Share Posted October 27, 2018 Seems you use an older version of AutoIt. Check the current version: https://www.autoitscript.com/autoit3/docs/libfunctions/_FileWriteFromArray.htm My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
oemript Posted October 27, 2018 Author Share Posted October 27, 2018 For function FileWriteFromArray, there is no append option. if I want to append array into File, I would like to know on whether FileWriteFromArray is the right function or not. Do you have any suggestions? Thank you very much for any suggestions (^v^) Link to comment Share on other sites More sharing options...
water Posted October 27, 2018 Share Posted October 27, 2018 It is the right function. According to the help file section I have linkted you to, you need to use a filehandle by calling FileOpen first (and don't forget to call FileClose when you are done to save all changes to the file). My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki 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