File path in shell argument

Hi

I am getting a ‘file not found’ error when trying to open a pdf using Acrobat Reader when using Shell in LotusScript

if I use

AdobeObject = Shell(“C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe C:\TempStyle.pdf”, 3)

then all is fine.

but if I use

AdobeObject = Shell(“C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe C:\Document and Settings\Administrator\Application Data\TempStyle.pdf”, 3)

or

AdobeObject = Shell(“C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe C:\Document%20and%20Settings\Administrator\Application%20Data\TempStyle.pdf”, 3)

then I get an error. I want to use this location,or a similar one, to comply with user access policy.

Any ideas much appreciated.

Hugh

Subject: file path in shell argument

I just tried your code…

AdobeObject = Shell(“C:\Program Files\Adobe\Reader 8.0\Reader\AcroRd32.exe C:\Document and Settings\Administrator\Application Data\TempStyle.pdf”, 3)

…but I changed the text to open my version of AR along with a PDF in my “C:\Documents and Settings\blah\blah\blah!” directory. And it worked with no problems. Here’s the code i used, fyi:

AdobeObject = Shell(“C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32.exe C:\Documents and Settings\Philip Haynes\Local Settings\Temp\testpdf.pdf”, 3)

So i guess there are two possibilities:

  1. The string you build for the shell parameter contains an error (lack of backslash before the filename perhaps).

  2. Acrobat reader 5.0 can take a parameter including spaces, whereas 8.0 can’t.

If no. 2 is the cause then have you tried enclosing the parameters in quotes? e.g.,

AdobeObject = Shell(|“C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32.exe” “C:\Documents and Settings\Philip Haynes\Local Settings\Temp\testpdf.pdf”|, 3)

It may be wise to do this anyway as windows shell and command-line commands often fall over when a parameter contains a space.

Subject: file path in shell argument

I suspect that the filepath should be: DocumentS and settings

So an extra S at Documents.

Subject: RE: file path in shell argument

Sorry - my typo

it is actually Documents and Settings in the code. I actually obtain that path using

Dim appDataStr As String

appDataStr = Environ("APPDATA")

If  AppDataStr <> "" Then

	GetWinProfilePath = AppDataStr + "\"

Hugh