Best way to iterate over lines in Dropbox action

Hi!

I’ve a really simple action that I use to append the content of a draft to a markdown file on Dropbox. Until now, it has always been one line drafts. But from now on, it sometimes will be multi line drafts. And since I want to add the current date to each line, I need a way to iterate over the draft.

What I currently have in the action is nothing more than

*[[date]]* [[draft]]

and what I need is something like

*[[date]]* [[lineX]]

where the action is related once for every line in the draft.

Try amending this example I put together.

It uses some script to split the draft up and prefix each line as you defined above. It concatenates them as it goes along and then sets a custom tag at the end.

A typical Dropbox append action then uses that tag to append to the file. You should modify this action for your own file… once you have a backup and have ensured this does what you want :wink:

Hope that helps.

1 Like

It did, thanks! Just made a small modification since I don’t need the extra row after the last iteration.

Glad it helped. :sunglasses:

After the last iteration, when you next run the action would it not append the first line of the second run to the last line of the first run; rather than to a new line after the last line of the first run?