Opening a PDF File with Arguments
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Opening a PDF File with Arguments
I am familiar with the launch document command which is great for opening pdf's, but I would like to open a pdf file to a specific location, and that requires arguments. Can I pass arguments to the launch document command? Or is there a way to look up what application would launch that file and then use that from the command line?
Dan
I believe the "launch document" command would have exactly the same effect as double-clicking a file - ie it would open that file with the appropriately registered application. I don't think parameters can be passed.
However you can easily start an application and pass it the arguments you need using the shell commands.
Something like
However you can easily start an application and pass it the arguments you need using the shell commands.
Something like
Code: Select all
set the hideConsoleWindows to true
get shell ("start" && quote & quote && quote & "theFileName.pdf" & quote && quote & "argument1" & quote && quote & "argument2" & quote)
--the "extra" quotes at the beginning are because the first quoted parameter passed to "start"
--are used as the console window title - so there's an empty "title" parameter there.
--You may find you need to wrap the whole lot in another set of quotes, but that will be a case
--of your own experimentation to tell you whether it's needed.
The problem is that I need to pass arguments to the pdf reader executable. To do this I got the command to run for pdf files from the registry:
And then I appended the parameters to pdfcmd and ran that in the shell.
Code: Select all
put queryRegistry("HKEY_CLASSES_ROOT\AcroExch.Document\Shell\Open\Command\") into pdfcmd
Dan