How to add variable inside arguments of open application properties

Hello all, i have a situation which if someone could help. Thanks in advance
Problem: how to add variable inside arguments to open application properties so that the argument applies on all pdf files
Scenario: i have a loop that collects all the files inside master folder and then return all the pdf files inside sub-folder.
What i want to do: the process should be able to loop through all pdf files in the sub-folders and then from there, using open application activity, i want to be able to zoom the all pdf files to full.

Usually, you will put the application path in the FileName property, such as your PDF Reader application. I also suggest when doing this to use the environment path to your default PDF application rather than hardcoding the entire path, because when the version changes, the path could change on you.

Then, for Argument property, you will use the file path of your file surrounded by quotation characters.

Here is an example of this:

Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software").OpenSubKey("Microsoft").OpenSubKey("Windows").OpenSubKey("CurrentVersion").OpenSubKey("App Paths").OpenSubKey("AcroRd32.exe").GetValue("").ToString

As you can see I used 4 quotes to embed the quotation characters around the filepath, and the filepath will be the variable used within your For each loop to process each pdf file.

I hope this helps you. If you need further help, please post some screenshots or xaml of what you have and we can identify the problems.

EDIT: also want to add that the reason you need quotations around the filepath is because this is an argument, just like if you were to start a process using command prompt.


1 Like

here is the screen shot of my project.


and here is the screenshot of properties pane for open application activity

what i am trying to achieve is to be able expand pdf files to full zoom after it open the application. i am using “ctrl+2” as send hotkey activity inside open application activity to do so

let me know if this was helpful or if you need anything

Looking at your Arguments property, I think you need to use more quotes to embed the quotation character. "" is an empty string, whereas """" is the quotation character.

So should be this:


i changed using 4 quotations on both sides but still same issue

What is the issue or error you are getting?

Also, the path in the Arguments should be to your file, not folder, if it is not already.

The situation is like that i dont have a single file. to add to the filename thats why i am trying to learn how to use a variable that will loop through all files

How did you set up your For Each loop?

Normally, you can do this:
For each file In System.IO.Directory.GetFiles(MasterFolderPath, "*.pdf", System.IO.SearchOption.AllDirectories)

The .GetFiles() can get you the list of files in that folder path, then use file in your Arguments for the Open Application.

here is the snapshot of whole process. for Assign value is used the same logic as you mentioned in the comment above


Your For each activity needs to have the ArgumentType property set to String, and that will resolve your compiler error.

Also, I don’t think you set up your loop correctly.
See here:

Replace MasterFolderPath with the list of files that you assigned to a variable. So it will instead read: ForEach file in folderList

I hope that solves it. Let me know if you need further help.


Hey, what am i doing wrong i am getting this error. sorry if my questions sounds basic i am super new to this. Here are the screen shot of what i am doing. please take a look at my arguments, filename, and selectors

Seems like your selector for NitroPro is wrong.
Open UiExplorer image and select the window and see if the selector matches what you have in the Open Application activity.

Feel free also to post what the selector says here and I can provide feedback.


1 Like

I am still getting the same error after using same selector as given by UI explorer.

Just to make sure that we are on the same page. With open application i am trying to Open the nitro pro and expand the file to full zoom using ‘CTRL+2’ shortcut key. i want to be able to do this task on all the files that exist in the sub folders.

I really appreciate your replies

Yeah, I believe we are on the same page. Problem is your Open Application is having problem identifying the application since you are opening a file in it.

Try this instead. Use the Start Process activity using the same thing for Argument and the same thing for FileName that you used in the Open Application. Then, right after that, use an Attach Window. In the Attach Window selector, you will want to open a file with NitroPDF, and get the selector of the window of one file - then, replace the filepath in the selector with your variable. Here is a snippet of that where you get the Filename of the file and replace the extension with a wildcard:

where filePath will be file in your case, and the app will be nitropdf.

Make sure you edit this selector as a string, though, and not in the Selector Editor. You can do this by editing directly in the property box where there are quotations around the selector.
Your selector in the Attach Window might look like this:
"<wnd app='nitropdf.exe' cls='Afx:*' title='*"+System.IO.Path.GetFileNameWithoutExtension(file)+"*' />


1 Like

Thank you so much for your help. I worked. Yay!