launching adobe reader with arguments from os.system call

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Greg Miller

    #1

    launching adobe reader with arguments from os.system call

    Currently I am launching adobe reader using the following call:
    os.system("path .file.pdf")
    this works fine for opening the pdf doc at the beginning. We would like
    to enhance this and open the document to either a page or a nameddest
    in the doc. The syntax for that in the DOS command prompt world is:
    acroRd32.exe /A "nameddest=Befo re You Begin" "path.file. pdf"
    However the os.system call won't allow me to call reader using that
    syntax. Does anyone know how I can launch the Reader application and
    pass in the parameters required to allow the document to be opened to
    the named destination? Thanks in advance!!

  • Martin Miller

    #2
    Re: launching adobe reader with arguments from os.system call

    Greg Miller wrote:[color=blue]
    > Currently I am launching adobe reader using the following call:
    > os.system("path .file.pdf")
    > this works fine for opening the pdf doc at the beginning. We would like
    > to enhance this and open the document to either a page or a nameddest
    > in the doc. The syntax for that in the DOS command prompt world is:
    > acroRd32.exe /A "nameddest=Befo re You Begin" "path.file. pdf"
    > However the os.system call won't allow me to call reader using that
    > syntax. Does anyone know how I can launch the Reader application and
    > pass in the parameters required to allow the document to be opened to
    > the named destination? Thanks in advance!![/color]

    I'm not sure how/if you can do what you want with os.system(), but this
    is what I've used to pass arguments directly to applications on
    Windows:[color=blue]
    > # spawn text editor on file
    > import os
    > applpath = r'C:\Windows\sy stem32\notepad. exe'
    > filepath = r'D:\My Documents\somef ile.txt'
    > os.spawnv(
    > os.P_WAIT,
    > applpath,
    > [ # argument list
    > applpath,
    > filepath
    > ]
    > )[/color]

    A downside is that it requires you to know the full path to the
    application, 'acroRd32.exe' in your case. On the other hand, I think
    you could pass just about any argument values (as strings) that you
    wished in the list passed as the third argument.

    HTH,
    -Martin

    Comment

    • Greg Miller

      #3
      Re: launching adobe reader with arguments from os.system call

      Thank you Martin, here's what I discovered this morning to work, the
      only problem is it is painfully slow to launch the application.

      os.system('star t acroRd32.exe'+' /A'+' "page=15"'+ '
      "C:\\Gregtemp\\ estelletest\\Ne xGlosser_User_G uide_W60G00_en. pdf"')

      I'm going to give your method a try to see if it launches any quicker.
      Thanks again.

      Greg Miller

      Comment

      • Steve Holden

        #4
        Re: launching adobe reader with arguments from os.system call

        Greg Miller wrote:[color=blue]
        > Thank you Martin, here's what I discovered this morning to work, the
        > only problem is it is painfully slow to launch the application.
        >
        > os.system('star t acroRd32.exe'+' /A'+' "page=15"'+ '
        > "C:\\Gregtemp\\ estelletest\\Ne xGlosser_User_G uide_W60G00_en. pdf"')
        >
        > I'm going to give your method a try to see if it launches any quicker.
        > Thanks again.
        >
        > Greg Miller
        >[/color]
        You might notice that if you already have an Acrobat Reader window open
        the document comes up rather more quickly.

        If you want fast document startup you could consider using the win32all
        extensions to create an AcroReader application process in advance of
        opening any documents.

        regards
        Steve
        --
        Steve Holden +44 150 684 7255 +1 800 494 3119
        Holden Web LLC http://www.holdenweb.com/

        Comment

        • Greg Miller

          #5
          Re: launching adobe reader with arguments from os.system call

          Thank you for the information, when I launched the Reader on the actual
          hardware it launched quickly. I think I just have too much running on
          my application PC. I will consider starting an AcroReader app however.

          Greg

          Comment

          Working...