I was writing the script looking at the sample you gave in the original post.
The scenario is the following:
- The script looks for blocks of text with “Steps” paragraph style applied
- in the last paragraph in a block it reads the step number
- then it looks at the paragraph preceding the first paragraph in the block, if it’s style name is “Header”, it continues
- if the header already contains “(“ 1+ digits “ steps)” at the end, it updated only the number; if doesn’t, it inserts “(“ + the number + “ steps)”
That’s the way the script currently works. My purpose was to prove that it’s possible to do in principle.
In my opinion, developing a script, in most cases, is dependent on a specific document it is written for. Requesting me to write a script without providing me with a sample document for testing is alike asking me to draw your portrait without showing your face (I’m artist by education).
Regards,
Kasyan