Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 4 of 4

Thread: Shell.Execute

  1. #1
    Join Date
    Mar 2009
    Posts
    15

    Shell.Execute

    Hey guys,

    why is:
    Shell.Execute(SessionVar.Expand("C:\\Program Files\\Adobe\Reader 9.0\\Reader\\AcroRd32.exe"), "open", "/A page=15 bla.Pdf", "", SW_SHOWNORMAL);


    not working?!
    the Adobe Reader is in this path...

    thanks for help

  2. #2
    Join Date
    Oct 2007
    Location
    Gensokyo
    Posts
    1,324
    Quote Originally Posted by Farewell View Post
    Hey guys,

    why is:
    Shell.Execute(SessionVar.Expand("C:\\Program Files\\Adobe\Reader 9.0\\Reader\\AcroRd32.exe"), "open", "/A page=15 bla.Pdf", "", SW_SHOWNORMAL);


    not working?!
    the Adobe Reader is in this path...

    thanks for help
    Well.
    • You gave a full path instead of a SessionVar.
    • The \ after Adobe should be \\.

  3. #3
    Join Date
    Mar 2009
    Posts
    15
    hm ok,
    what would be the correct Sessionvar?

    thanks

  4. #4
    Join Date
    Apr 2005
    Location
    São Paulo, Brazil
    Posts
    2,539
    You should retrieve the correct handler for PDF files from the registry. This way, you would have the proper syntax, as well as the path to the application, which depends on the version and language of the operating system.

    Ulrich

  5. #5
    Join Date
    Jan 2001
    Location
    Anderson Island, WA, USA
    Posts
    2,863
    Quote Originally Posted by Farewell View Post
    hm ok,
    what would be the correct Sessionvar?

    thanks
    ShadowUK pointed out the main flaw with the exact code:
    Adobe\Reader should be Adobe\\Reader

    as ulrich pointed out; you have an underlaying problem with portability of your code. you should use the system to fetch the pdf handler (not everyone may have that exact version of acrobat installed, indeed, not everyone even has acrobat...)

    Code:
    lcPDF = File.GetDefaultViewer("PDF");
    if lcPDF and File.DoesExist( lcPDF ) then
      File.Run( lcPDF, "/A page=15 bla.Pdf");
    else
      Dialog.Message("Error","No handler for PDF's")
    end


    (Click here to contact me)
    Providing Independent Professional Consulting Services for
    IndigoRose products, World Wide.
    Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts