Help Opening a Program then Open a File and Loop the Open File Sequence until Program is exited

Hi guys - Another UIPath late adopter :stuck_out_tongue_closed_eyes:

So here is what I am trying to do:

  1. Open program.exe
    2.Open file folder
  2. Select file.txt
  3. Open file .txt
  4. Expand window of Program.exe
  5. Repeat 2 - 5
  6. Exit program.exe at my discretion

I got 1 - 5 to work with a basic sequence, I just don’t know how to add a loop to my work.

ArrayVariable = Directory.GetFiles(filepath)
for each filename in array perform your actions

Hi Vinutha!

Thank you for responding!

I didn’t specify that I am opening the same file multiple times
and sometimes it errors but I want it to try and open it again.

Is there a way to add a timer (to open every 20 mins)

Can you please attach an example? Thank you so much!!

:star_struck:

So I think I know what I need - not sure how to use them:

The “IF” and “LOOP” In SEQUENCE,

1. Start Program.exe
2. Open File Folder in Program.exe
3a. IF File.txt does not exist, end Program.exe
3b. IF File.txt exist
4a. Open File.txt in Program.exe
4b. Expand window of Program.exe
5. Repeat from 2.

If someone can help me with a screen shot example of how to use the IF and “LOOP” - that would be awesome.

Hi @Jazzy_44,

For checking the file path you can use Path Exists activity and pass your file path as input and the output will be a boolean variable.
Use the boolean variable in the If condition, then part will contain the opening file, else part will contain the End program

Example screenshot:

If your requirement is to repeat this process every 20 mins you could use the Orchestrator scheduling.

Thanks PD2, This is awesome! My only issue now is the file name - can it be a wildcard? Even with a specific file name - I am getting validation error warnings - the output “fileExist” isn’t working :frowning:

EDIT:

Ahh! I see what the issue was - I needed to define the variable as a boolean :hugs:

Now to fine tune then - scheduling Yay! Thank you

1 Like