Page 1 of 1
Opening a PDF File with Arguments
Posted: Mon Jul 27, 2009 10:05 pm
by danrg7
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?
Posted: Mon Jul 27, 2009 11:00 pm
by SparkOut
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
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.
Posted: Tue Jul 28, 2009 6:43 pm
by danrg7
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:
Code: Select all
put queryRegistry("HKEY_CLASSES_ROOT\AcroExch.Document\Shell\Open\Command\") into pdfcmd
And then I appended the parameters to pdfcmd and ran that in the shell.