Write a bat script that follows this pseudo code and use {{{PLACEHOLDER_for_<item>}}} this format for placeholders:
1) Search for a <text file>
2) If file is found then proceed to next step. Else not found then wait 30 second and go back to step 1. (This loop should only execute for 20 times at NAME_1)
3) Search for a <NAME_2> inside that text file.
4) If the NAME_2 is found, go to next step. Else go to step 6.
5) Execute a <command>.
6) Exit