How to paste incremental numbers higher than 1?

I am trying to paste numbers incrementally but with blocks of two i.e. 2,4,6,8,10

I have worked out how to do this with one number as shown here but I'm unsure about blocks of two.

Any Ideas?

Thank you!

Hey Simon,

It's not too clear what you're trying to do.

Just paste 2,4,6,8.

Or paste

2
4
6
8

Or add line numbers to existing lines.

Here's something to chew on.

-Chris


Generic-Test 01.kmmacros (4.8 KB)

Thank you for your reply ccstone, sorry for the late reply back I have been very busy. I understand how that works but I have used this method instead. It means I will be able to limit how many times the loop will run without having to type a character on a new line a text file everytime I want to change this amount.

Now my problem is I have a for each loop running in a for each loop and when the inner for each loop finishes (even with an if condition which breaks the loop) the inner loop carries on. Is there a reason for this?

Hey Simon,

I don't think you said what you meant.

-Chris

I have managed to get the inner ‘for each’ loop to stop once finishing through using a regular expression which comes to the end of a text after going line by line. Then the outer ‘for each’ loop (based on counting upwards) carries on. I am now wondering how to press enter after appending text to a text file.

Si

Please include your macro - no macro shown so far has a inner and outer For Each action, so it’s very hard to understand what issue you are talking about.

I appreciate the help but I no longer have the problem anymore. I created a loop which would insert one number and then insert ten numbers after, like this.

1
10 20 30 40 50 60 70 80
2
10 20 30 40 50 60 70 80
3
10 20 30 40 50 60 70 80

I created a loop within a loop to achieve this,But I have solved this problem.

I have now created a macro for inserting codes into a text file. I need these codes to be inserted once on every line. I can insert these by using the appending text action and text is inserted all on the same line but how to make each code inserted into the text file appear on a separate line? Or how do press enter when appending text into a text file so on each loop a new line is created?

Thank you

Hey Simon,

You have to read the file into a variable, iterate over the lines while saving them to a new variable and then rewrite the text file (or write a new one).

It would be easier to advise you if you'd provide a proper sample of the data before and the result data.

-Chris

Hi CC Stone the data that is being written to the text file are strings of numbers such as

123456123456123456123456123456

and the resultant data I need in the format on each line.

123456
123456
123456
123456
123456

There is alot of data so it will save me alot of time!

Does this make sense?

Thank you

Include a \n character in the text for a linefeed end of line character in the file you write.