Write to File - unexpected line breaks!

  • Hello,
    I've been trying to teach myself BAS for a few months in my spare time. I want to create some simple web page scrapers, and write the data to file (csv) -- one web page per row.

    I created a simple scraper using
    Load URL, then Get Element Text for each piece of data I want (one variable for each Get Element Text), and a 'write to file, instruction at the end for all the variables. I will create a csv from the output, so I add a comma between each variable. My 'Write to file' instruction looks like this:

    {{bookListTitle}},[[BOOKTITLE_TEXT]],by [[AUTHORNAME_TEXT]],https://www.amazon.com/dp/[[ISBN_TEXT]],[[BOOKCOVER_URL]] ... etc

    I have 'append' and 'line break' ticked.

    BUT when I open the text file created by that instruction, it has inserted line breaks between each variable, and multiple spaces also. I have tried outputting as a csv and as a txt file, but get the same result.

    I also tried outputting without the commas inserted between each variable but it STILL adds new lines and spaces.

    I have also tried with and without 'append' and 'add line break' ticked. But get the same result (although the 'line break' should be at the end of the write instruction, not for every individual variable, but I tried it anyway).

    I also tried using XPath instead of CSS to isolate elements, but still the same.

    What am I doing wrong?

  • please try to clear (trim) variables before use

    [[STRING]] = [[STRING]].trim()

Log in to reply