Hi
I've used AHK in the past for some clicking, copy paste, windows switching, etc. but it's the first time I use it to read data from a file.
I have a file of names,numbers,email (1 line per person, infos separated by commas) in CSV (I also have it in XLS if it's easier that way).
I also have another program who has fields (A name field, A Last name field, email field, etc.).
I want to use AHK to make it press the "New" button, then the window with fields open, then it reads the first line from the CSV, write the correct infos in each fields, then press Save.
Rince and repeat for the other lines in the CSV.
I'm not quite good at programming, and I've searched this forum and the archive forum without any successful info for me.
Is someone here can help me?
Thanks!
CSV to fields from another program Topic is solved
Re: CSV to fields from another program
Can you please post any code you've already tried and also an example of the CSV file?
Thanks
Thanks
Re: CSV to fields from another program
I don't have any code right now as I don't know where to start. I have the file in a plain Excel format, and also converted it in CSV. I can also use Excel to read cells if it's more easy.TLM wrote:Can you please post any code you've already tried and also an example of the CSV file?
Thanks
I can't also show my CSV as it is sensible info, but I'll paste a sample with false data :
Code: Select all
F1,2131,[email protected],John Doe
F1,55311,[email protected],Jane Doe
F2,7332,[email protected],John Smith
F3,23451,[email protected],Jane Smith
Re: CSV to fields from another program Topic is solved
This should be fairly easy to do with two loops, a file read loop and a CSV parse loop. Here is an example:
Code: Select all
FileSelectFile, FilePath
Loop, Read, %FilePath%
{
;Any code that needs to be executed for each line of the CSV file goes here
Loop, Parse, A_LoopReadLine, CSV
{
;Inside this loop, the variable A_LoopField contains the value of the current field in the CSV file
;For example, it will contain F1 the first time, then 2131, then [email protected], then John Doe
;After that, the outer loop will move to the next line of the CSV file
;You can use the variable A_Index to count which loop you are on. For example:
if (A_Index = 1)
{
;What to do with the first column goes here
}
else if (A_Index = 2)
{
;What to do with the second column goes here
}
}
}
Re: CSV to fields from another program
I am struggling with the same. How can use the code as displayed above?
I mean where to define the file name?
I mean where to define the file name?
Who is online
Users browsing this forum: No registered users and 148 guests