Start Process or Open Application > Argument Property Syntax Question

I’ve tried using both Open Application and Start Process to open a PDF document … both successfully. However I am having difficulty determining the syntax to use in UiPath for passing “app arguments” (input) on to the application I’m trying to open.

In this case I’m opening Adobe Reader X at 100% zoom, and scroll the view over and down.

Reviewing Adobe’s Parameters for Opening PDFs (http://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf) it suggests this should be possible:

zoom=scale,left,top (Scroll values left and top are in a coordinate system where 0,0
represents the top left corner of the visible page, regardless of
document rotation)

When opening a PDF document from a command shell, you can pass the parameters to the open
command using the /A switch with the following syntax:
/A “=” “”
For example:
Acrobat.exe /A “zoom=1000” “C:\example.pdf”

I have been using a “Generic Value” variable that I call “pdfFullPath”. When I pass this in to the Executable Path of Start Process it opens the pdfs as expected (looping through list of pdfs in a folder). Likewise, if I use Open Application, set the selector to the appropriate cls=‘AcrobatSDIWindow’ and filename to the adobe executable file, I can pass the variable in the arguments Input to open the correct file…but as for the additional arguments I’m stuck trying to pass along the extra parameters.

I’d prefer to use Start Process this time as Open Application keeps presenting a warning about opening in protected mode. However for future cases I’d like to know the syntax of both options. I’ve tried every combination I could think of: with and without the /A,“zoom=100,100,100”, “zoom=100” before and after the variable (concatenating with + symbol).

Any tips for a UiPath Rookie!?

I do have the workflow working with workarounds sending a lot of hotkeys and keystrokes to reposition the PDF as needed but recognizing the additional parameters would be far less hack-y.

Thanks in advance

1 Like

Hello,

When using Start Process activity, the FileName property should point to the adobe executable (in my case Adobe Acrobat Reader DC, so AcroRd32.exe) and then in the Arguments property you can put your pdf parameters, precedeed by “/A” and followed by the path to the .pdf file. Here’s a capture with the activity:

Edit: As for Open Application activity, the FileName property is the same as above and the Arguments property is the same but with the executable at the beginning of the string (“AcroRd32.exe /A…”). The “title” attribute of the Selector property should be modified to the title of the .pdf file as it appears in the upper-left corner when the file is open (e.g. “file.pdf - Adobe Acrobat Reader DC”), or you can also use wildcards for something less specific. Here are captures with the properties:

Capture2


Capture3


Capture4

6 Likes

image

image

This worked. Is this what you wanted?

3 Likes

Thanks florin.stan: great outline and I appreciate such a quick response.

A few things I learned:

Although I had been putting a variable with the Full Path of the “File” (not the Adobe Reader Program) into the first box [Filename] it was still opening and running the file but not allowing me to pass the arguments. Now I realize I should be putting the Program’s Filename in the [Filename] box and the variable name of the actual file in the [Arguments] box.

To use the variable name of the file in a loop and to adjust the scroll to the bottom right corner of the page I modified your [Arguments] example as follows:

"/A zoom=100,10000,10000 "+pdfFullPath

Interestingly I was also encountering a problem with the page opening with the Bookmarks and Tools panels displayed which was restricting the scroll from going all the way to the right. I had to close both of these items before setting the zoom/scroll to get the pdf to scroll to the correct position. Ampersand (&) turns out to be the correct syntax for chaining multiple parameters: the pagemode parameter turns off Bookmarks panel and toolbar parameter turns off the Tools panel.

Final result:

"/A pagemode=none&toolbar=0&zoom=100,10000,10000 "+pdfFullPath

{please note: a space at the end of the string between the parameters being passed and the variable pathname must be included or the file won’t open}

Thanks again for your help!

4 Likes

Hi All,

any idea what would be the pat if I want to open the excel file, I tried below .

image

Hi Hitshs,

Your screenshot refers to the FileName. In Arguments, type the specific file path, for example: “C:\Users\myUser\Documents\test.xlsx”. And make sure that the Selector has the title of your specific file: title=“test - Excel”.

Hope this helps!

Hi Avi,

Thanks for response , I tried related suggestions could not work, I am attaching my solution kindly check what is wrong.
Testing open excel file.zip (1.5 MB)

What are you trying to achieve? I can see that you are copying a range from an excel file to another, but i don’t understand what’s the point of click Start. Can you give me the steps?

there is a macro enable excel , from first excel I am copying a range and pasting in other file.

Moving on first sheet to on VB based form submit ,using click image.
if the file is open solution is working properly but if file is closed it doesn’t as Image is not visible, to achieve that I have to keep the file open.

Are you talking about the VB based form to be opened before click on Start?

yes @ovi , I tried click activity and recording as well following to Excel Application Scope.

So after Excel Application Scope, what if you use Open Application or Start process to open your form and then use recording or Click activity?

Hello all, my problem is somehow similar and though to post it here and see if someone could help. will really appreciate your help.
Problem: how to add variable inside arguments of 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 pdf to full.

Take a loop ( For Each item in PDFlist) , PDFlist is where all the file paths has been saved as array of strings. ( make sure “For Each” type Argument set to String)
“item” will return the full path of your individual PDF file . Provide the Adobe Reader application path and in argument field use “item” variable to pass the PDF file path along with Adobe reader arguments in start process activity.