Read from a table, fit web form?

Guys, I'm a beginner – at least with this tool. I used to use QuickKeys excessively, but that was centuries ago.

What I would like to do is the following, and I would like to ask you if this is just possible or if it will be a tricky matter.

  1. Opening a website. I am already logged in.

  2. Click on a button.

  3. A form with five fields and a few buttons appears.

  4. I want a text to be read from a CSV file (or something similar) from the first line from the first field and the first form field is entered.

  5. Then continue with the second and third form fields with text out of the same line.

  6. Then click on a button in the web form.

  7. Then to a second, which only appears at that moment.

  8. Now a text field appears in which a text should be entered.

  9. Now the first line in the CSV file should be deleted.

The next time I start this process, I would work with the texts from the second line of the CSV.

How complicated is it to set up something like this? In particular, reading from a CSV file is something that I have not yet found, for example.

1 Like

Welcome to the forum and thanks for being clear with your first question. I shall leave it to others to give comprehensive replies, because their solutions will be more elegant than my suggestions!

While you wait, though, you might be interested to look at the Wiki about the following: for step (1), read about the open a URL action; for step (4), see the read a file action.

Also, let us know which browser (or browsers) you will be using, and, if possible, the Web site in question.

For this you just need the "Read a File" action -- there's also "Write to a File" for when you want to save it out minus the first line.

  1. So you read the file into a variable, get the first line, save the three fields into variables
  2. Then do some stuff on the web page
  3. If that goes smoothly, delete the first line from the variable and write that variable out to a file

This demos the CSV read/write bits -- create a file named testCSV.csv on your Desktop containing

1,2,3,4,5
6,7,8,9,10
11,12,13,14,15
16,17,18,19,20

...and run the macro repeatedly and you'll see that it returns the first three values of the first line then writes it out minus that first line.

Get and Remove First Line of CSV.kmmacros (7.4 KB)

Image

There are almost certainly better/quicker ways of doing this, but the macro serves as a gentle intro to some KM basics -- you'll find everything there in the manual or on the Wiki, but ask if anything isn't clear.

The web site bit will be trickier to help with, especially if it isn't available to Forum members. The best way to work with web forms is using "Browser Form Actions", but if they aren't available because of how the form is coded you can usually use "Type a Keystroke" to tab to a field and "Insert Text by Typing" (or "...by Pasting" for bigger text blocks) to insert values, along with image detection and the "Pause Until" and "Move or Click Mouse" actions to wait for/click buttons.