forum0member Posted May 20, 2014 Posted May 20, 2014 Hello, I need a example how to call data from csv file and write to csv file. Can you help me with an example script, please? I am using: - Win 7 - AutoIt Version: 3.3.11.5 (Beta) - FF.au3 - MozRepl Addon
Moderators JLogan3o13 Posted May 20, 2014 Moderators Posted May 20, 2014 Have you bothered searching the forum? There are a number of posts dealing with csv files. If you are looking for something more detailed, then we need a more detailed description from you. Please give us an idea of the data and structure of the csv file (or attach a screenshot/example file), as well as what you have tried yourself. Help us help you "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
water Posted May 20, 2014 Posted May 20, 2014 Welcome to Autoit and the forum! Do you have Excel installed on your computer? 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
forum0member Posted May 20, 2014 Author Posted May 20, 2014 An example for this: This is how i fill form with imacros: How is this possible with autoit? VERSION BUILD=7500718 RECORDER=FX 'Uses a Windows script to submit several datasets to a website, e. g. for filling an online database TAB T=1 ' Specify input file (if !COL variables are used, IIM automatically assume a CSV format of the input file 'CSV = Comma Separated Values in each line of the file SET !DATASOURCE Address.csv 'SET !DATASOURCE_COLUMNS 8 'Start at line 2 to skip the header in the file SET !LOOP 2 'Increase the current position in the file with each loop SET !DATASOURCE_LINE {{!LOOP}} ' Fill web form URL GOTO=http://demo.imacros.net/Automate/AutoDataEntry TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:fname CONTENT={{!COL1}} TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:lname CONTENT={{!COL2}} TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:address CONTENT={{!COL3}} TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:city CONTENT={{!COL4}} TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:zip CONTENT={{!COL5}} ' 'Note * is used to ignore leading and trailing blanks that could be in the input data ' 'The precent (%) symbol is used to select the stateid by VALUE as defined in the website select statement and not by its index. TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=NAME:state CONTENT=$*{{!COL6}}* ' 'The string ($) symbol is used to select the country by TEXT, not by its index. 'Index would be the position of an entry in the combo box list, e. g. 161 for United States TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=NAME:country CONTENT=$*{{!COL7}}* ' TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:email CONTENT={{!COL8}} TAG POS=1 TYPE=BUTTON:submit FORM=ID:demo ATTR=TXT:Submit TAG POS=1 TYPE=A ATTR=TXT:*Back*
water Posted May 20, 2014 Posted May 20, 2014 If I understand you and the posted code correctly you try to read a CSV file line by line and insert the fields of each line into a web page? 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
water Posted May 20, 2014 Posted May 20, 2014 To read the content of a CSV file into an array I suggest to use this >UDF: You can then loop through this array and send the data to the web page. 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
forum0member Posted May 20, 2014 Author Posted May 20, 2014 Thank you very much water. This works great!
water Posted May 20, 2014 Posted May 20, 2014 Automating Firefox will be a bit harder 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
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