racfriedman Posted February 26, 2021 Report Share Posted February 26, 2021 Hi everyone, This is my first time using Macro Express and I'm slowing starting to get the hang of it...I think. I'm trying to make a macro that opens a website, pulls the first value from a csv file, then enters more variables from the first line before looping back to search for the second value, etc. So far I've managed to get the macro to execute everything correctly for the first line, now I'm not sure how to get it to repeat the process, reference the next line and then stop the macro after all the records are entered. until the end of the csv file. Does anyone know how to help? :S I've attached a copy of my macro for reference. File.mex Quote Link to comment Share on other sites More sharing options...
Cory Posted February 26, 2021 Report Share Posted February 26, 2021 Use ASCII File Process for the loop. Quote Link to comment Share on other sites More sharing options...
racfriedman Posted February 26, 2021 Author Report Share Posted February 26, 2021 Hi Cory, I know I would repeat the ASCII File Process section but I'm not sure how to get it so that once it completes the loop it moves on to the next line of data in the csv file I'm also not sure if there are specific repeat settings I should use that would help with this Quote Link to comment Share on other sites More sharing options...
Cory Posted February 26, 2021 Report Share Posted February 26, 2021 ASCII File Process is a loop. Quote Link to comment Share on other sites More sharing options...
Cory Posted February 26, 2021 Report Share Posted February 26, 2021 Every iteration of the command reads in another line of data. All the elements in that line are put into an array variable you will use to do your iterative process. Quote Link to comment Share on other sites More sharing options...
racfriedman Posted February 26, 2021 Author Report Share Posted February 26, 2021 It keeps starting back a couple of steps after the beginning of the ASCII File Process and it keeps repeating the first line of data Quote Link to comment Share on other sites More sharing options...
Cory Posted February 26, 2021 Report Share Posted February 26, 2021 "The ASCII File Process is a powerful command that extracts data from text files, one line at a time. The values of each record are saved to variables for later use, such as inserting the extracted values into other applications. This is an efficient method for transferring data from one file to another." - Help Might be a problem with your data file. Post a sample and I'll check it for you quick. Quote Link to comment Share on other sites More sharing options...
racfriedman Posted February 26, 2021 Author Report Share Posted February 26, 2021 Modria Geico Automated List - Copy - Copy.csv The macro enters the value from column A into the website and then performs some functions before inputting the values from columns B C D E F G H into their appropriate fields. Once the ASCII Process reaches the last function it should move to line 2 of the csv file and do it all over again but it doesn't pull the value of cell A2 and instead repeats the data from A1 Quote Link to comment Share on other sites More sharing options...
Cory Posted February 26, 2021 Report Share Posted February 26, 2021 00000000h: EF BB BF 31 2C 44 61 77 6E 2C 41 2C 35 31 36 33 ; 1,Dawn,A,5163 00000010h: 35 35 39 36 39 36 2C 24 31 33 31 2E 30 35 20 2C ; 559696,$131.05 , 00000020h: 30 2C 24 34 30 2E 30 30 20 2C 24 32 36 2E 32 31 ; 0,$40.00 ,$26.21 00000030h: 20 0D 0A 32 2C 44 61 77 6E 2C 41 2C 35 31 36 33 ; ..2,Dawn,A,5163 00000040h: 35 35 39 36 39 36 2C 22 24 32 2C 39 33 33 2E 37 ; 559696,"$2,933.7 00000050h: 34 20 22 2C 30 2C 24 34 30 2E 30 30 20 2C 24 35 ; 4 ",0,$40.00 ,$5 00000060h: 38 36 2E 37 35 20 0D 0A ; 86.75 .. This is the Hex view showing all the bytes. Decoded characters at the right. This is not an ASCII file, it's UTF-8 with a BOM. See those three bytes () at the beginning? That's the BOM (byte order marker). You need to either save this as UTF-8 without BOM or ASCII/ANSI. I'm guessing you used Notepad, which used to be pure ASCII but a few years ago was upgraded to do UTF-8-BOM as default. I'm going to ask ISS to update MEP to handle UTF-8 with BOM. BTW, MEP doesn't do Unicode. I also noticed that you have trailing spaces in many columns, E.G. "$131.05 ,". See the space between the five and the comma? Best to fix these in your source, but if not, you can delete the first three characters of the file in MEP and save. And you can use a trim command on the others with the trailing spaces. If you save the file correctly, does it work? Quote Link to comment Share on other sites More sharing options...
racfriedman Posted February 26, 2021 Author Report Share Posted February 26, 2021 Oh my goodness!!! I think it's working! I have some minor cursor positioning and delays to adjust but thank you so much!!! Quote Link to comment Share on other sites More sharing options...
Cory Posted February 26, 2021 Report Share Posted February 26, 2021 Here's how to save. Note default is UTF-8-BOM. Quote Link to comment Share on other sites More sharing options...
Cory Posted February 26, 2021 Report Share Posted February 26, 2021 I'm glad I was able to edify. I hope the rest goes well for you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.