Opening PDF from a folder fails



Hi all!
I’m saving a lot of PDFs like this:

  • Pdf (1).pdf
  • Pdf (2).pdf

  • The problem is when I try to open each file (they are in a folder) with StartProcess activity Adobe Reader says “There was an error opening this document. This file cannot be found”. Somebody knows how to save them in a different way (without the space) or rename all (to take out the space).




The space shouldn’t cause any problems. In your Start Process, your argument (or filename) should be embedded in quotes.

For example, pdf (1).pdf will need to be “pdf (1).pdf” and since the whole thing needs to be a string also you need to double up on quotes.

""""pdf (1).pdf""""

If you were to output your argument in a message box or write line, it should show the quotations also, just like if you were opening it in commandline.

You can alternatively use the Open Application activity to open the file.
It might also be useful to know that you can get your default Adobe Reader from the registry with this line:

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




Hi Clayton, thanks for your response.

I’m passing my path sometihng like this:

Because item is part of For Each activity.
How can I put double quotes to it? If I put them to item.tostring it takes as a string, not the item variable value



If item is the file in a ForEach that you want to pass in the argument field, then you can do it like this:


The 4 quotes on the ends should embed a quotation mark on both sides of the file. You can also verify this with a message box or write line and check if the filename is correct.



Thank you so much! It’s working!