JMackXIII Posted February 8, 2023 Posted February 8, 2023 Ok, so I need to automate a task and I was planning on using Auto IT. I have the task portion built, I am running/exporting a Crystal Report file. My issue I am scratching my head on is I need to run the same report over and over and the report parameters will be stored in the CSV file. I need to parse the CSV file grab each set of variables run my function I already built and loop through the CSV file for each line of variables. I have tried a few things I found online to prace the CSV file but nothing seems to work. What would be the easiest way to parse the file, and read each "set" of CSV items and pass that long. but also be able to loop through until the file is complete.
water Posted February 8, 2023 Posted February 8, 2023 Did you have a look at this section in the AutoIt wiki? There you'll find at least 3 UDFs to read/write CSV files. 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
JMackXIII Posted February 8, 2023 Author Posted February 8, 2023 I did not, but I will take a look at this thank you
JMackXIII Posted February 8, 2023 Author Posted February 8, 2023 Looked at the read CSV post.. grabbed the CSV file and updated it with my data set.. while it sort of reads the file.. however it dumps the values into one column so it doesn't seem to be parsing it correctly even though looking at the file I can see that it is in face using a , as a eliminator and the script file has that as the default. It's also from a post that is 13 years old so things may have changed.
water Posted February 8, 2023 Posted February 8, 2023 Can you please post the script you run and the CSV file you try to process? So we can play a bit 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
mistersquirrle Posted February 9, 2023 Posted February 9, 2023 My suggestion would be to read the file with _FileReadToArray: https://www.autoitscript.com/autoit3/docs/libfunctions/_FileReadToArray.htm This has some basic support for CSVs, so as long as there's nothing non-standard in the file, it should do a fine job: #include <File.au3> #include <FileConstants.au3> #include <Array.au3> Local $aFileRead _FileReadToArray('test.csv', $aFileRead, $FRTA_NOCOUNT, ',') _ArrayDisplay($aFileRead) And the test.csv file: asdf,qwer,zxcv meow,woof,oink hello,hey,hi We ought not to misbehave, but we should look as though we could.
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