Use a global field for you custom dialog's input field such as Globals::gNumRecs
then your loop can be:
Go To Layout [//Specify layout based on your table of activity records here]
Set Variable [$K ; value: $K + 1 ]
Exit Loop If [$K > Globals::gNumRecs]
Set Field [ActivityTable::id_activity ; $ID]
I'd need to take it to the next level. Let's say I've got the list of those descriptions in .txt. As to copy/paste them all would be a painful, time-consuming and least attractive use of my time, I thought of doing it this way:
In addition to what was described already:
1. User clicks on the button "Create new activity records"
2. Custom dialog is shown and the user inserts the desired number of new activity records (let's say, 23) to be created in the input field
I would add one more step - Add global field, in which I could copy/paste .txt file contents and then click OK.
After I click OK, not only it would create 23 records using loop script and set ID_activity, but also it would parse text of the global field, and fill in "description" field. I believe it would be somewhat similar as you wrote here: http://forums.filemaker.com/posts/9bd322ed0c
There just would not be two lines, that don't need to be parsed, every line is necessary and 1st line of that text corresponds with 1st activity record, 2nd line with 2nd and so on.
So basically two things here: ability to set custom number of records and ability to parse text and set fields with results.
If there is one line of text in the global field for each record to be created, you don't have to ask the user to enter a number, you can just loop through the lines of text in the global field. Instead of copy/paste, you also have the option to import the text into a table in your database. That could create the records and enter the text for you without a need for any action except that of importing the record from the .txt file.