Create a Loop that does the same thing to multiple powerpoint slides

Hi there! Pardon me if I sound like I am spewing gibberish as I am still planning on how to go about creating this process.

So basically, I have about 100 powerpoint files that have the exact same format but with different details, and i need to carry out the exact same activities to all 100 of them. My current solution is to record a desktop recording in file explorer to open all of the powerpoint files, and manually add the processes to each powerpoint application window snap, but that would be inefficient and not dynamic as the number of powerpoint files that I have may increase/decrease over time.

I tried using Directory.GetFiles() but I’ve had no luck so far. I could only get the file names and was not able to get any of the files to open in Open Application. Hence, I am wondering if it is possible to make this entire process dynamic (works even if the number of powerpoint files increase/decrease) instead of it being static (fixed to work only on that specific 100 powerpoint files).

So sorry for any inconvenience and thank you for your time.

Hi @Dan_Y
As you know, open application needs full path but I think you have directory and file name in there, so why don’t you create full path to open those file?

Like,
For each fileName

  1. String full path = concatenate directory & fileName
  2. Open application with full path
  3. do something you want
    End for

Isn’t it work?
Rgds,
J,

Hi @Jumbo,

Thank you for your reply. I am aware that open application requires file name, selector and arguments. However, I have difficulties with getting the selector for the open application scope, and my best guess would be that it is dynamic as the file name changes, thus I am not sure as to how i should go about the selector of my open application scope in the for loop.

Would it be possible for me to make the selector of the open application scope dynamic?

So sorry for any inconvenience and thank you so much for your help.

Best Regards,
Dan

Hi @Dan_Y

You can omit file name from the selector like below.

And then you enter your full path string of which you’d like to open as argument, I think it will be work.

Regards,
J,

Hi @Jumbo,

I have tried your method and powerpoint did open. However, these messages all came out.

Captureforum5 Captureforum6 Captureforum7 Captureforum2 Captureforum3

The argument passed into Open Application was
Captureforum1
and it was taken from

where Directory.GetFiles(“C:\Users\Jun Hui Yap\Desktop\testing only for data scraping\New Folder”)

So sorry to bother you but did I make any mistakes in my process?

Best Regards,
Dan

@Dan_Y

I think you need escape sequence when you use space-contained full path. Please refer below post.

Hey @Jumbo,

Thanks for your article reference. I managed to solve the issue of the file and folder name being spliced up. However, I still cannot open the file.
This is the error:
image

I also realised that from the directory, UiPath goes through my project folder before going to \New_folder\Hello_this_me.pptx when it should directly go through

Is it possible that i made some mistake in my process, thus causing this to happen?

So sorry for any inconvenience caused and thank you.

Best Regards,
Dan

Hi Dan,

I’m not quite sure about your case but might be your name cause of it. (I mean space in it)
image

Or if impossible to use open application, I don’t now why but I recommend you to use invoke power shell to start your file.

J,

Hi @Jumbo,

I noticed that as well, so I placed the folder inside C: directly, thus with the updated directory being C:\testing_only for_data_scraping\New_folder . However, the issue still persists. I will try to see if I can invoke powershell to start my file, and get back to you.

So sorry for any inconvenience and thank you so much for your help.

Best Regards,
Dan